Skip to content

Commit d546edb

Browse files
committed
Build: Serve many lesser used platforms with abi3 wheels.
1 parent bde0b2b commit d546edb

2 files changed

Lines changed: 110 additions & 19 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 93 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ jobs:
4444
contents: write
4545

4646
steps:
47-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.1
47+
- name: Check out project
48+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4849

4950
- name: Set up Python
5051
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
@@ -72,10 +73,11 @@ jobs:
7273
outputs:
7374
include: ${{ steps.set-matrix.outputs.include }}
7475
steps:
75-
- uses: actions/checkout@v6.0.1
76+
- name: Check out project
77+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7678
- name: Install cibuildwheel
7779
# Nb. keep cibuildwheel version pin consistent with job below
78-
run: pipx install cibuildwheel==3.3.0
80+
run: pipx install cibuildwheel==3.4.1
7981
- id: set-matrix
8082
run: |
8183
MATRIX=$(
@@ -92,6 +94,9 @@ jobs:
9294
} | jq -sc
9395
)
9496
echo "include=$MATRIX" >> $GITHUB_OUTPUT
97+
env:
98+
# Skip abi3 targets here:
99+
CIBW_SKIP: "cp31?-win_arm64 cp31?-win32 pp* cp3[89]*musllinux* cp31?-musllinux*"
95100

96101
build_wheels:
97102
name: Build ${{ matrix.only }}
@@ -104,8 +109,8 @@ jobs:
104109
include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }}
105110

106111
steps:
107-
- name: Check out the repo
108-
uses: actions/checkout@v6.0.1
112+
- name: Check out project
113+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
109114

110115
- name: Set up QEMU
111116
if: runner.os == 'Linux'
@@ -114,14 +119,14 @@ jobs:
114119
platforms: all
115120

116121
- name: Build wheels
117-
uses: pypa/cibuildwheel@v3.3.0
122+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
118123
with:
119124
only: ${{ matrix.only }}
120125

121126
- name: Build faster Linux wheels
122127
# also build wheels with the most recent manylinux images and gcc
123128
if: runner.os == 'Linux' && !contains(matrix.only, 'i686')
124-
uses: pypa/cibuildwheel@v3.3.0
129+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
125130
env:
126131
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_34
127132
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_34 # manylinux_2_39 ?
@@ -143,9 +148,87 @@ jobs:
143148
path: ./wheelhouse/*.whl
144149
name: wheels-${{ matrix.only }}
145150

151+
build_limited_api_wheels:
152+
name: Build ${{ matrix.target }} Stable ABI ${{ matrix.lapiversion }} wheels
153+
if: >-
154+
github.event_name == 'push' ||
155+
github.event_name == 'release' ||
156+
(github.event_name == 'schedule' && github.repository == 'cython/cython') ||
157+
github.event_name == 'workflow_dispatch'
158+
159+
strategy:
160+
fail-fast: false
161+
matrix:
162+
target:
163+
# Smaller set of platforms that we only provide Stable ABI wheels for:
164+
- 'musllinux_x86_64'
165+
- 'musllinux_aarch64'
166+
- 'manylinux_i686'
167+
- 'musllinux_i686'
168+
- 'manylinux_ppc64le'
169+
- 'musllinux_ppc64le'
170+
- 'manylinux_riscv64'
171+
- 'musllinux_riscv64'
172+
- 'manylinux_armv7l'
173+
- 'musllinux_armv7l'
174+
- 'macosx_x86_64'
175+
- 'win32'
176+
- 'win_arm64'
177+
lapiversion:
178+
- "3.9"
179+
- "3.12"
180+
181+
runs-on: ${{
182+
contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' ||
183+
contains(matrix.target, 'armv7l') && 'ubuntu-24.04-arm' ||
184+
contains(matrix.target, 'win_arm64') && 'windows-11-arm' ||
185+
contains(matrix.target, 'win32') && 'windows-latest' ||
186+
contains(matrix.target, 'macosx') && 'macos-latest' ||
187+
'ubuntu-latest'
188+
}}
189+
190+
steps:
191+
- name: Check out project
192+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
193+
194+
- name: Set up Python
195+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
196+
with:
197+
python-version: '3.x'
198+
199+
- name: Set up QEMU
200+
if: runner.os == 'Linux'
201+
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
202+
with:
203+
platforms: all
204+
205+
- name: Setup Visual Studio on Windows
206+
if: startsWith(matrix.target, 'win')
207+
uses: TheMrMilchmann/setup-msvc-dev@79dac248aac9d0059f86eae9d8b5bfab4e95e97c # v4.0.0
208+
with:
209+
arch: ${{ matrix.target == 'win32' && 'x86' || matrix.target == 'win_arm64' && 'arm64' || matrix.target == 'win_amd64' && 'amd64' || '' }}
210+
211+
- name: Build wheels
212+
uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1
213+
env:
214+
CIBW_BUILD: "*${{ matrix.target }}"
215+
CIBW_SKIP: "cp31*t-* pp3*"
216+
CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ matrix.lapiversion }}"
217+
218+
- name: Check wheel
219+
run: |
220+
python -m pip install twine
221+
python -m twine check ./wheelhouse/*.whl
222+
223+
- name: Upload wheels
224+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
225+
with:
226+
name: Stable-ABI-${{ matrix.target }}-${{ matrix.lapiversion }}
227+
path: ./wheelhouse/*.whl
228+
146229
merge_wheels:
147230
name: Merge wheel archives
148-
needs: build_wheels
231+
needs: [build_wheels, build_limited_api_wheels]
149232
runs-on: ubuntu-latest
150233

151234
steps:
@@ -167,8 +250,8 @@ jobs:
167250
contents: write
168251

169252
steps:
170-
- name: Check out the repo
171-
uses: actions/checkout@v6.0.1
253+
- name: Check out project
254+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
172255

173256
- name: Download files
174257
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0

pyproject.toml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ skip = ["pp*", "*-musllinux_i686", "cp35*", "cp36*", "cp37*"]
77
enable =["cpython-freethreading", "cpython-prerelease"]
88
# test-command = "python -m unittest {package}/test_fractions.py -p -v"
99

10+
[tool.cibuildwheel.windows]
11+
archs = ["AMD64", "x86"]
12+
13+
[tool.cibuildwheel.macos]
14+
# https://cibuildwheel.readthedocs.io/en/stable/faq/#what-to-provide suggests to provide
15+
# x86_64 and one of universal2 or arm64 wheels. x86_64 is still required by older pips,
16+
# so additional arm64 wheels suffice.
17+
#archs = ["x86_64", "universal2"]
18+
archs = ["x86_64", "arm64"]
19+
1020
[tool.cibuildwheel.linux]
1121
archs = ["x86_64", "aarch64", "i686", "ppc64le", "armv7l", "riscv64"]
1222
repair-wheel-command = "auditwheel repair --strip -w {dest_dir} {wheel}"
@@ -32,12 +42,10 @@ select = "*aarch64"
3242
inherit.environment = "append"
3343
environment.CFLAGS = "-O3 -g1 -pipe -fPIC -march=armv8-a -mtune=cortex-a72"
3444

35-
[tool.cibuildwheel.windows]
36-
archs = ["AMD64", "x86"]
37-
38-
[tool.cibuildwheel.macos]
39-
# https://cibuildwheel.readthedocs.io/en/stable/faq/#what-to-provide suggests to provide
40-
# x86_64 and one of universal2 or arm64 wheels. x86_64 is still required by older pips,
41-
# so additional arm64 wheels suffice.
42-
#archs = ["x86_64", "universal2"]
43-
archs = ["x86_64", "arm64"]
45+
[[tool.cibuildwheel.overrides]]
46+
#select = "*i686 *musllinux* *win32 *win_arm64 *macosx_x86_64 *armv7l"
47+
select = "*i686 *musllinux* *macosx_x86_64 *armv7l *ppc64le *riscv64"
48+
inherit.test-requires = "append"
49+
test-requires = ["abi3audit>=0.0.25"]
50+
inherit.test-command = "append"
51+
test-command = ["abi3audit --strict --report {wheel}"]

0 commit comments

Comments
 (0)