@@ -196,33 +196,166 @@ jobs:
196196 - name : Test Swift
197197 run : swift test
198198
199- build_wheels :
200- name : Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
201- runs-on : ${{ matrix.os }}
199+ # Compiling Python images is a nightmare, assuming the number of platforms we support
200+ # To minimize cross-compilation we use separate runners for each platform
201+ # https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
202+ # https://cibuildwheel.pypa.io/en/stable/#what-does-it-do
203+ # Available Linux images: https://cibuildwheel.pypa.io/en/stable/options/#linux-image
204+ build_wheels_linux_x86 :
205+ name : Build Python Wheels (Linux x86)
206+ runs-on : ubuntu-22.04
207+ strategy :
208+ matrix :
209+ python-version : ["37", "38", "39", "310", "311", "312", "313"]
210+ needs : [test_python]
211+ steps :
212+ - name : Checkout
213+ uses : actions/checkout@v4
214+ - name : Install Python
215+ uses : actions/setup-python@v5
216+ with :
217+ python-version : " 3.9"
218+ - name : Install Toolchain
219+ run : |
220+ python -m pip install cibuildwheel
221+ cibuildwheel --output-dir wheelhouse
222+ env :
223+ # Matches: `cp37-manylinux_x86_64` and `cp38-musllinux_x86_64`
224+ CIBW_BUILD : cp${{ matrix.python-version }}-*
225+ CIBW_PLATFORM : linux
226+ CIBW_ARCHS : x86_64
227+ CIBW_MANYLINUX_X86_64_IMAGE : manylinux_2014
228+ CIBW_MUSLLINUX_X86_64_IMAGE : musllinux_1_2
229+
230+ build_wheels_linux_arm :
231+ name : Build Python Wheels (Linux ARM)
232+ runs-on : ubuntu-22.04-arm64
233+ strategy :
234+ matrix :
235+ python-version : ["37", "38", "39", "310", "311", "312", "313"]
202236 needs : [test_python]
237+ steps :
238+ - name : Checkout
239+ uses : actions/checkout@v4
240+ - name : Install Python
241+ uses : actions/setup-python@v5
242+ with :
243+ python-version : " 3.9"
244+ - name : Install Toolchain
245+ run : |
246+ python -m pip install cibuildwheel
247+ cibuildwheel --output-dir wheelhouse
248+ env :
249+ # Matches: `cp37-manylinux_aarch64` and `cp38-musllinux_aarch64`
250+ CIBW_BUILD : cp${{ matrix.python-version }}-*
251+ CIBW_PLATFORM : linux
252+ CIBW_ARCHS : aarch64
253+ CIBW_MANYLINUX_AARCH64_IMAGE : manylinux_2014
254+ CIBW_MUSLLINUX_AARCH64_IMAGE : musllinux_1_2
255+
256+ build_wheels_macos_x86 :
257+ name : Build Python Wheels (macOS x86)
258+ runs-on : macos-13
203259 strategy :
204260 matrix :
205- os : [ubuntu-latest, macos-latest, windows-latest]
206261 python-version : ["37", "38", "39", "310", "311", "312", "313"]
262+ needs : [test_python]
207263 steps :
208- 209- - name : Set up Python
210- 264+ - name : Checkout
265+ uses : actions/checkout@v4
266+ - name : Install Python
267+ uses : actions/setup-python@v5
211268 with :
212- python-version : 3.9
269+ python-version : " 3.9"
270+ - name : Install Toolchain
271+ run : |
272+ python -m pip install cibuildwheel
273+ cibuildwheel --output-dir wheelhouse
274+ env :
275+ CIBW_BUILD : cp${{ matrix.python-version }}-*
276+ CIBW_PLATFORM : macos
277+ CIBW_ARCHS : x86_64
213278
214- # We only need QEMU for Linux builds
215- - name : Setup QEMU
216- if : matrix.os == 'ubuntu-latest'
217- uses : docker/setup-qemu-action@v3
218- - name : Upgrade MSVC tooling
219- if : matrix.os == 'windows-latest'
279+ build_wheels_macos_arm :
280+ name : Build Python Wheels (macOS ARM)
281+ runs-on : macos-14
282+ strategy :
283+ matrix :
284+ python-version : ["37", "38", "39", "310", "311", "312", "313"]
285+ needs : [test_python]
286+ steps :
287+ - name : Checkout
288+ uses : actions/checkout@v4
289+ - name : Install Python
290+ uses : actions/setup-python@v5
291+ with :
292+ python-version : " 3.9"
293+ - name : Install Toolchain
294+ run : |
295+ python -m pip install cibuildwheel
296+ cibuildwheel --output-dir wheelhouse
297+ env :
298+ CIBW_BUILD : cp${{ matrix.python-version }}-*
299+ CIBW_PLATFORM : macos
300+ CIBW_ARCHS : arm64
301+
302+ build_wheels_windows :
303+ name : Build Python Wheels (Windows)
304+ runs-on : windows-2022
305+ strategy :
306+ matrix :
307+ python-version : ["37", "38", "39", "310", "311", "312", "313"]
308+ architecture : [AMD64, ARM64, x86]
309+ needs : [test_python]
310+ steps :
311+ - name : Checkout
312+ uses : actions/checkout@v4
313+ - name : Install Python
314+ uses : actions/setup-python@v5
315+ with :
316+ python-version : " 3.9"
317+ - name : Setup MSVC
220318 uses : microsoft/setup-msbuild@v2
221319 with :
222320 vs-version : " 17.10"
223- - name : Install cibuildwheel
224- run : python -m pip install cibuildwheel==2.22.0
225- - name : Build wheels
226- run : cibuildwheel --output-dir wheelhouse
321+ - name : Install Toolchain
322+ run : |
323+ python -m pip install cibuildwheel
324+ cibuildwheel --output-dir wheelhouse
325+ env :
326+ CIBW_BUILD : cp${{ matrix.python-version }}-win_${{ matrix.architecture }}
327+ CIBW_PLATFORM : windows
328+
329+ build_wheels_other :
330+ name : Build Python Wheels (Other Platforms)
331+ runs-on : ubuntu-22.04
332+ strategy :
333+ matrix :
334+ python-version : ["37", "38", "39", "310", "311", "312", "313"]
335+ needs : [test_python]
336+ steps :
337+ - name : Checkout
338+ uses : actions/checkout@v4
339+ - name : Install Python
340+ uses : actions/setup-python@v5
341+ with :
342+ python-version : " 3.9"
343+ - name : Setup QEMU
344+ uses : docker/setup-qemu-action@v3
345+ - name : Install Toolchain
346+ run : |
347+ python -m pip install cibuildwheel
348+ cibuildwheel --output-dir wheelhouse
227349 env :
350+ # https://cibuildwheel.pypa.io/en/stable/options/#archs
228351 CIBW_BUILD : cp${{ matrix.python-version }}-*
352+ CIBW_PLATFORM : linux
353+ CIBW_ARCHS : ppc64le s390x i686 armv7l
354+ CIBW_MANYLINUX_I686_IMAGE : manylinux_2014
355+ CIBW_MANYLINUX_PPC64LE_IMAGE : manylinux_2014
356+ CIBW_MANYLINUX_S390X_IMAGE : manylinux_2014
357+ CIBW_MANYLINUX_ARMV7L_IMAGE : manylinux_2_31
358+ CIBW_MUSLLINUX_I686_IMAGE : musllinux_1_2
359+ CIBW_MUSLLINUX_PPC64LE_IMAGE : musllinux_1_2
360+ CIBW_MUSLLINUX_S390X_IMAGE : musllinux_1_2
361+ CIBW_MUSLLINUX_ARMV7L_IMAGE : musllinux_1_2
0 commit comments