Skip to content

Build Wheels

Build Wheels #12

Workflow file for this run

name: Build Wheels
on:
pull_request:
release:
types: [published]
workflow_dispatch:
jobs:
build_wheels_macos:
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) - ${{ matrix.py }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, macos-13]
py: [cp39, cp310, cp311, cp312]
arch: [arm64, x86_64]
exclude:
# macos-14 is Apple Silicon (arm64)
- os: macos-14
arch: x86_64
# macos-13 is Intel (x86_64)
- os: macos-13
arch: arm64
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-*
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.py }}
path: ./wheelhouse/*.whl
build_wheels_linux:
name: Build wheels on Linux (${{ matrix.arch }}) - ${{ matrix.py }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py: [cp39, cp310, cp311, cp312]
arch: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
CIBW_BUILD: ${{ matrix.py }}-manylinux_${{ matrix.arch }}
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.arch }}-${{ matrix.py }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
merge:
name: Merge artifacts
runs-on: ubuntu-latest
needs: [build_wheels_macos, build_wheels_linux, build_sdist]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: all-wheels
delete-merged: true
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [merge]
if: github.event_name == 'release' && github.event.action == 'published'
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: all-wheels
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1