Skip to content

Commit a9ad89e

Browse files
committed
Make: Parallel CI for Python wheels
1 parent d66f697 commit a9ad89e

File tree

2 files changed

+52
-25
lines changed

2 files changed

+52
-25
lines changed

.github/workflows/prerelease.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,30 @@ jobs:
302302
context: .
303303
load: true
304304
push: false
305+
306+
307+
build_wheels:
308+
name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
309+
runs-on: ${{ matrix.os }}
310+
needs: [test_ubuntu_gcc, test_ubuntu_clang, test_macos, test_windows]
311+
strategy:
312+
matrix:
313+
os: [ubuntu-latest, macos-latest, windows-latest]
314+
python-version: ["37", "38", "39", "310", "311", "312"]
315+
steps:
316+
- uses: actions/checkout@v4
317+
- name: Set up Python
318+
uses: actions/setup-python@v5
319+
with:
320+
python-version: 3.x
321+
322+
# We only need QEMU for Linux builds
323+
- name: Setup QEMU
324+
if: matrix.os == 'ubuntu-latest'
325+
uses: docker/setup-qemu-action@v3
326+
- name: Install cibuildwheel
327+
run: python -m pip install cibuildwheel
328+
- name: Build wheels
329+
run: cibuildwheel --output-dir wheelhouse
330+
env:
331+
CIBW_BUILD: cp${{ matrix.python-version }}-*

.github/workflows/release.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -346,39 +346,36 @@ jobs:
346346
* ${{ steps.hashes.outputs.asset_name_15 }} : `${{ steps.hashes.outputs.asset_hash_15 }}`
347347
348348
build_wheels:
349-
name: Build Python
350-
needs: versioning
349+
name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
351350
runs-on: ${{ matrix.os }}
351+
needs: versioning
352352
strategy:
353-
fail-fast: false
354353
matrix:
355-
os: [ubuntu-22.04, macOS-11, windows-2022]
356-
354+
os: [ubuntu-latest, macos-latest, windows-latest]
355+
python-version: ["37", "38", "39", "310", "311", "312"]
357356
steps:
358-
- uses: actions/checkout@v3
357+
- uses: actions/checkout@v4
359358
with:
360359
ref: "main"
361-
- uses: actions/setup-python@v3
362-
363-
- name: Setup Docker
364-
if: matrix.os == 'ubuntu-22.04'
365-
uses: crazy-max/[email protected]
360+
- name: Set up Python
361+
uses: actions/setup-python@v5
366362
with:
367-
version: 23.0.1
368-
363+
python-version: 3.x
369364
- name: Setup QEMU
370-
if: matrix.os == 'ubuntu-22.04'
371-
uses: docker/[email protected]
372-
373-
- name: Install CIBuildWheel
365+
if: matrix.os == 'ubuntu-latest' # We only need QEMU for Linux builds
366+
uses: docker/setup-qemu-action@v3
367+
- name: Install cibuildwheel
374368
run: python -m pip install cibuildwheel
375-
376369
- name: Build wheels
377-
run: python -m cibuildwheel
378-
379-
- uses: actions/upload-artifact@v3
370+
run: cibuildwheel --output-dir wheelhouse
371+
env:
372+
CIBW_BUILD: cp${{ matrix.python-version }}-*
373+
- name: Upload wheels
374+
uses: actions/upload-artifact@v4
380375
with:
376+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
381377
path: ./wheelhouse/*.whl
378+
overwrite: true
382379

383380
publish_python:
384381
name: Publish Python
@@ -392,17 +389,20 @@ jobs:
392389

393390
steps:
394391
- name: Download artifacts
395-
uses: actions/download-artifact@v3.0.2
392+
uses: actions/download-artifact@v4
396393
with:
397-
path: ./dist/
394+
# unpacks all CIBW artifacts into dist/
395+
pattern: cibw-*
396+
path: dist
397+
merge-multiple: true
398398

399399
- name: Publish to PyPi
400400
uses: pypa/gh-action-pypi-publish@release/v1
401401
with:
402-
packages-dir: ./dist/artifact
402+
packages-dir: dist
403403
verbose: true
404404
print-hash: true
405-
405+
406406
publish_javascript:
407407
name: Publish JavaScript
408408
needs: versioning

0 commit comments

Comments
 (0)