Fixing build #26
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 and publish Python wheels | |
| on: | |
| push: | |
| branches: ["master"] | |
| tags: | |
| - 'release/v[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| branches: ["*"] | |
| workflow_dispatch: # allow manual test-runs without a tag | |
| jobs: | |
| build_wheels: | |
| name: Wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| # Each runner builds for its native architecture. | |
| # Linux aarch64 uses a native ARM GitHub-hosted runner. | |
| os: [ubuntu-latest, ubuntu-24.04-arm, macos-14] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Install GMP (macOS) | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| brew install gmp || true | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| # Linux builds happen inside Docker; CCACHE_DIR is set to /project/.ccache | |
| # (= .ccache relative to the checkout) so the host can cache it. | |
| # macOS builds are native; ccache uses ~/.ccache by default. | |
| path: | | |
| .ccache | |
| ~/.ccache | |
| key: ccache-wheels-${{ matrix.os }}-${{ github.sha }} | |
| restore-keys: ccache-wheels-${{ matrix.os }}- | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.1.0 | |
| # All cibuildwheel settings live in [tool.cibuildwheel] in pyproject.toml. | |
| # The only per-runner override needed is the arch selector: | |
| env: | |
| CIBW_ARCHS_LINUX: native # x86_64 on ubuntu-latest, aarch64 on ubuntu-24.04-arm | |
| CIBW_ARCHS_MACOS: native # arm64 on macos-14, x86_64 on macos-15-intel | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: wheelhouse/*.whl | |
| publish: | |
| name: Publish to PyPI | |
| needs: build_wheels | |
| runs-on: ubuntu-latest | |
| # Publish on version tags (v...) or release tags (release/v...); not on branch pushes or workflow_dispatch. | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release/v') | |
| environment: pypi | |
| permissions: | |
| id-token: write # required for OIDC trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |