Skip to content

Commit a2658f2

Browse files
committed
ci: use uv + cibuildwheel to build all wheels
Previously, wheel builds were a combination of using `cibuildwheel` and `pip wheel`. On Linux, we manually spawned a container image and provided our own script for building the wheel. This commit standardizes on using `cibuildwheel` everywhere. We run `cibuildwheel` via `uv` as a dependency package so behavior is more deterministic.
1 parent ceb3ee6 commit a2658f2

6 files changed

Lines changed: 91 additions & 147 deletions

File tree

.github/workflows/wheel.yml

Lines changed: 84 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,77 @@ jobs:
1010
fail-fast: false
1111

1212
matrix:
13-
image:
14-
- 'manylinux2014_aarch64'
15-
- 'musllinux_1_1_aarch64'
16-
- 'musllinux_1_2_aarch64'
17-
- 'manylinux2014_i686'
18-
- 'musllinux_1_2_i686'
19-
- 'manylinux2014_ppc64le'
20-
- 'musllinux_1_2_ppc64le'
21-
- 'manylinux2014_s390x'
22-
- 'musllinux_1_2_s390x'
23-
- 'manylinux2014_x86_64'
24-
- 'musllinux_1_1_x86_64'
25-
- 'musllinux_1_2_x86_64'
2613
py:
27-
- 'cp39-cp39'
28-
- 'cp310-cp310'
29-
- 'cp311-cp311'
30-
- 'cp312-cp312'
31-
- 'cp313-cp313'
32-
- 'cp314-cp314'
14+
- 'cp39'
15+
- 'cp310'
16+
- 'cp311'
17+
- 'cp312'
18+
- 'cp313'
19+
- 'cp314'
20+
arch:
21+
- 'aarch64'
22+
- 'i686'
23+
- 'ppc64le'
24+
- 's390x'
25+
- 'x86_64'
26+
abi:
27+
- 'manylinux'
28+
- 'musllinux'
29+
image:
30+
- 'manylinux2014'
31+
- 'musllinux_1_1'
32+
- 'musllinux_1_2'
3333
exclude:
34-
- image: 'musllinux_1_1_aarch64'
35-
py: 'cp314-cp314'
36-
- image: 'musllinux_1_1_x86_64'
37-
py: 'cp314-cp314'
38-
runs-on: ${{ endsWith(matrix.image, 'aarch64') && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}
34+
# Cancel out abi - image mismatch.
35+
- abi: 'manylinux'
36+
image: 'musllinux_1_1'
37+
- abi: 'manylinux'
38+
image: 'musllinux_1_2'
39+
- abi: 'musllinux'
40+
image: 'manylinux2014'
41+
# Remove some older ABIs that don't need to exist.
42+
- arch: 'ppc64le'
43+
image: 'musllinux_1_1'
44+
- arch: 's390x'
45+
image: 'musllinux_1_1'
46+
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}
47+
env:
48+
CIBW_ARCHS: ${{ matrix.arch }}
49+
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.abi }}_${{ matrix.arch }}
50+
CIBW_BUILD_VERBOSITY: '1'
51+
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/${{ matrix.image }}_aarch64:latest
52+
CIBW_MANYLINUX_I686_IMAGE: quay.io/pypa/${{ matrix.image }}_i686:latest
53+
CIBW_MANYLINUX_PPC64LE_IMAGE: quay.io/pypa/${{ matrix.image }}_ppc64le:latest
54+
CIBW_MANYLINUX_S390X_IMAGE: quay.io/pypa/${{ matrix.image }}_s390x:latest
55+
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}_x86_64:latest
56+
CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/${{ matrix.image }}_aarch64:latest
57+
CIBW_MUSLLINUX_I686_IMAGE: quay.io/pypa/${{ matrix.image }}_i686:latest
58+
CIBW_MUSLLINUX_PPC64LE_IMAGE: quay.io/pypa/${{ matrix.image }}_ppc64le:latest
59+
CIBW_MUSLLINUX_S390X_IMAGE: quay.io/pypa/${{ matrix.image }}_s390x:latest
60+
CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }}_x86_64:latest
61+
ZSTD_WARNINGS_AS_ERRORS: '1'
3962
steps:
4063
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4164
with:
4265
persist-credentials: false
4366

67+
- name: Install uv
68+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
69+
with:
70+
version: "0.8.11"
71+
4472
- name: Set up QEMU
4573
if: ${{ endsWith(matrix.image, 'ppc64le') || endsWith(matrix.image, 's390x') }}
4674
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
4775

4876
- name: Build Wheel
4977
run: |
50-
docker run -e PYPATH=/opt/python/${{ matrix.py }} -e ZSTD_WARNINGS_AS_ERRORS=1 --rm -v `pwd`:/project quay.io/pypa/${{ matrix.image }} /project/ci/build-manylinux-wheel.sh
78+
uvx -p 3.13 cibuildwheel@3.1.4 --output-dir dist
5179
5280
- name: Upload Wheel
5381
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5482
with:
55-
name: linux-${{ matrix.py }}-${{ matrix.image }}
83+
name: linux-${{ matrix.py }}-${{ matrix.arch }}-${{ matrix.abi }}-${{ matrix.image }}
5684
path: dist
5785

5886
macos:
@@ -71,27 +99,23 @@ jobs:
7199
- 'x86_64'
72100
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }}
73101
env:
74-
CIBW_ARCHS: ${{ matrix.arch }}
75-
CIBW_BUILD: ${{ matrix.py }}-*
102+
CIBW_ARCHES: ${{ matrix.arch }}
103+
CIBW_BUILD: ${{ matrix.py }}-macosx_${{ matrix.arch }}
76104
CIBW_BUILD_VERBOSITY: '1'
77105
ZSTD_WARNINGS_AS_ERRORS: '1'
78106
steps:
79-
- name: Set up Python
80-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
81-
with:
82-
python-version: '3.13'
83-
84107
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
85108
with:
86109
persist-credentials: false
87110

88-
- name: Install Dependencies
89-
run: |
90-
python -m pip install --require-hashes -r ci/requirements.macoswheels.txt
111+
- name: Install uv
112+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
113+
with:
114+
version: "0.8.11"
91115

92116
- name: Build Wheel
93117
run: |
94-
cibuildwheel --output-dir dist
118+
uvx -p 3.13 cibuildwheel@3.1.4 --output-dir dist
95119
96120
- name: Upload Wheel
97121
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
@@ -104,41 +128,40 @@ jobs:
104128
fail-fast: false
105129
matrix:
106130
py:
107-
- '3.9'
108-
- '3.10'
109-
- '3.11'
110-
- '3.12'
111-
- '3.13'
112-
- '3.14'
131+
- 'cp39'
132+
- 'cp310'
133+
- 'cp311'
134+
- 'cp312'
135+
- 'cp313'
136+
- 'cp314'
113137
arch:
114-
- 'x86'
115-
- 'x64'
116-
- 'arm64'
138+
- 'win32'
139+
- 'win_amd64'
140+
- 'win_arm64'
117141
exclude:
118-
- py: '3.8'
119-
arch: 'arm64'
120-
- py: '3.9'
121-
arch: 'arm64'
122-
- py: '3.10'
123-
arch: 'arm64'
124-
runs-on: ${{ matrix.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
142+
- py: 'cp39'
143+
arch: 'win_arm64'
144+
- py: 'cp310'
145+
arch: 'win_arm64'
146+
runs-on: ${{ matrix.arch == 'win_arm64' && 'windows-11-arm' || 'windows-2022' }}
125147
env:
148+
CIBW_ARCHES: ${{ matrix.arch }}
149+
CIBW_BUILD: ${{ matrix.py }}-${{ matrix.arch }}
150+
CIBW_BUILD_VERBOSITY: '1'
126151
ZSTD_WARNINGS_AS_ERRORS: '1'
127152
steps:
128-
- name: Set up Python
129-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
130-
with:
131-
python-version: ${{ matrix.py }}
132-
architecture: ${{ matrix.arch }}
133-
allow-prereleases: true
134-
135153
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
136154
with:
137155
persist-credentials: false
138156

157+
- name: Install uv
158+
uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0
159+
with:
160+
version: "0.8.11"
161+
139162
- name: Build Wheel
140163
run: |
141-
python -m pip wheel -w dist .
164+
uvx -p 3.13 cibuildwheel@3.1.4 --output-dir dist
142165
143166
- name: Upload Wheel
144167
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

ci/build-manylinux-wheel.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

ci/requirements.macoswheels.in

Lines changed: 0 additions & 1 deletion
This file was deleted.

ci/requirements.macoswheels.txt

Lines changed: 0 additions & 57 deletions
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ select = ["E4", "E7", "E9", "F", "I"]
5757

5858
[tool.cibuildwheel]
5959
enable = ["cpython-prerelease"]
60+
build-frontend = "build[uv]"
61+
62+
[tool.cibuildwheel.linux]
63+
before-all = "if [ -x /usr/bin/yum ]; then yum install -y libffi-devel; fi"
6064

6165
# This is needed to suppress generation of license-file, which isn't
6266
# compatible with metadata version 2.1, which our pinned setuptools

uv.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)