Skip to content

Commit

Permalink
Make: Parallel CI for Python wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Feb 21, 2024
1 parent d66f697 commit a9ad89e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 25 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,30 @@ jobs:
context: .
load: true
push: false


build_wheels:
name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [test_ubuntu_gcc, test_ubuntu_clang, test_macos, test_windows]
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["37", "38", "39", "310", "311", "312"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x

# We only need QEMU for Linux builds
- name: Setup QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
50 changes: 25 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,39 +346,36 @@ jobs:
* ${{ steps.hashes.outputs.asset_name_15 }} : `${{ steps.hashes.outputs.asset_hash_15 }}`
build_wheels:
name: Build Python
needs: versioning
name: Build Python ${{ matrix.python-version }} for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: versioning
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macOS-11, windows-2022]

os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["37", "38", "39", "310", "311", "312"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: "main"
- uses: actions/setup-python@v3

- name: Setup Docker
if: matrix.os == 'ubuntu-22.04'
uses: crazy-max/[email protected]
- name: Set up Python
uses: actions/setup-python@v5
with:
version: 23.0.1

python-version: 3.x
- name: Setup QEMU
if: matrix.os == 'ubuntu-22.04'
uses: docker/[email protected]

- name: Install CIBuildWheel
if: matrix.os == 'ubuntu-latest' # We only need QEMU for Linux builds
uses: docker/setup-qemu-action@v3
- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel

- uses: actions/upload-artifact@v3
run: cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp${{ matrix.python-version }}-*
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
overwrite: true

publish_python:
name: Publish Python
Expand All @@ -392,17 +389,20 @@ jobs:

steps:
- name: Download artifacts
uses: actions/download-artifact@v3.0.2
uses: actions/download-artifact@v4
with:
path: ./dist/
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/artifact
packages-dir: dist
verbose: true
print-hash: true

publish_javascript:
name: Publish JavaScript
needs: versioning
Expand Down

0 comments on commit a9ad89e

Please sign in to comment.