Skip to content

Commit 2cbfee3

Browse files
authored
Build wheels with cibuildwheel (#8)
* Build wheels with cibuildwheel * Drop python from matrix * Don't gather artifacts for PRs
1 parent e199087 commit 2cbfee3

File tree

4 files changed

+66
-19
lines changed

4 files changed

+66
-19
lines changed

.github/workflows/build.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
paths-ignore:
7+
- '**.rst'
8+
- 'docs/**'
9+
push:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**.rst'
14+
- 'docs/**'
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build_wheels:
22+
strategy:
23+
matrix:
24+
os: ["ubuntu-20.04", "macos-11"]
25+
26+
runs-on: ${{ matrix.os }}
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
- name: Install dependencies
31+
run: |
32+
make requirements c_lib
33+
- name: Build wheels
34+
uses: pypa/[email protected]
35+
- name: Upload packages
36+
if: github.event_name == 'push'
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: ada-url-packages
40+
path: wheelhouse/*
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and test
1+
name: Unit tests
22

33
on:
44
pull_request:
@@ -21,38 +21,26 @@ jobs:
2121
build_test:
2222
strategy:
2323
matrix:
24-
os: ["ubuntu-20.04", "macos-latest"]
25-
python: ["3.8", "3.9", "3.10", "3.11"]
24+
os: ["ubuntu-20.04", "macos-11"]
2625

2726
runs-on: ${{ matrix.os }}
2827

2928
steps:
3029
- uses: actions/checkout@v3
31-
- name: Set up Python ${{ matrix.python }}
30+
- name: Set up Python 3.8
3231
uses: actions/setup-python@v4
3332
with:
34-
python-version: ${{ matrix.python }}
33+
python-version: "3.8"
3534
- name: Install dependencies
3635
run: |
3736
make requirements
3837
- name: Build packages
3938
run: |
4039
make package
41-
- name: Repair wheels
42-
if: "matrix.os == 'ubuntu-20.04'"
43-
run: |
44-
pip install -U auditwheel patchelf
45-
auditwheel repair --plat manylinux_2_24_x86_64 --wheel-dir dist dist/ada_url-*linux*.whl
4640
- name: Run tests
4741
run: |
4842
pip install -e .
4943
make coverage
50-
- name: Build docs with sphinx
51-
if: "matrix.python == '3.8' && matrix.os == 'ubuntu-20.04'"
44+
- name: Check docs
5245
run: |
5346
make docs
54-
- name: Upload packages
55-
uses: actions/upload-artifact@v3
56-
with:
57-
name: ada-url-packages
58-
path: dist/*

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ clean:
3232
$(RM) ada_url/_ada_wrapper.abi3.so
3333
$(RM) ada_url/ada.o
3434

35-
.PHONY: package
36-
package:
35+
.PHONY: c_lib
36+
c_lib:
3737
$(CXX) -c "ada_url/ada.cpp" -fPIC -std="c++17" -O2 -o "ada_url/ada.o"
38+
39+
.PHONY: package
40+
package: c_lib
3841
python -m build --no-isolation
3942
twine check dist/*

pyproject.toml

+16
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,19 @@ exclude = [
1515
".git",
1616
".ruff_cache",
1717
]
18+
19+
[tool.cibuildwheel]
20+
build = [
21+
"cp38-*",
22+
"cp39-*",
23+
"cp310-*",
24+
"cp311-*",
25+
"pp38-*",
26+
"pp39-*",
27+
]
28+
29+
[tool.cibuildwheel.linux]
30+
archs = ["x86_64"]
31+
32+
[tool.cibuildwheel.macos]
33+
archs = ["x86_64", "universal2", "arm64"]

0 commit comments

Comments
 (0)