Build Wheels #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Wheels | |
| on: | |
| pull_request: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels_macos: | |
| name: Build wheels on macOS (${{ matrix.arch }}) - ${{ matrix.py }} | |
| runs-on: macos-14 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Skip cp39 since we're targeting macOS 14.0+ (Homebrew libs require it) | |
| py: [cp310, cp311, cp312] | |
| # Only build arm64 for now - x86_64 cross-compile fails because | |
| # homebrew on arm64 runner installs arm64 libraries | |
| 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.arch }}-${{ matrix.py }} | |
| path: ./wheelhouse/*.whl | |
| # Linux builds temporarily disabled for faster iteration on macOS | |
| # 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 | |
| # Temporarily removed build_wheels_linux dependency | |
| needs: [build_wheels_macos, 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 |