Better checking of the assumps file #136
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, macos-15-intel, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Install GMP (macOS) | |
| if: contains(matrix.os, 'macos') | |
| run: | | |
| brew install gmp || true | |
| - name: Set up MSYS2 (Windows) | |
| id: msys2 | |
| if: contains(matrix.os, 'windows') | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW64 | |
| update: true | |
| install: >- | |
| mingw-w64-x86_64-gcc | |
| mingw-w64-x86_64-gmp | |
| mingw-w64-x86_64-zlib | |
| mingw-w64-x86_64-pkgconf | |
| mingw-w64-x86_64-ccache | |
| - name: Put MSYS2 MinGW toolchain on PATH (Windows) | |
| if: contains(matrix.os, 'windows') | |
| shell: pwsh | |
| # Use GITHUB_PATH/GITHUB_ENV; CIBW_ENVIRONMENT's bash parser mangles backslash paths. | |
| run: | | |
| "${{ steps.msys2.outputs.msys2-location }}\mingw64\bin" >> $env:GITHUB_PATH | |
| "PKG_CONFIG_PATH=${{ steps.msys2.outputs.msys2-location }}\mingw64\lib\pkgconfig" >> $env:GITHUB_ENV | |
| "CC=gcc" >> $env:GITHUB_ENV | |
| "CXX=g++" >> $env:GITHUB_ENV | |
| "CMAKE_GENERATOR=Ninja" >> $env:GITHUB_ENV | |
| - 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-${{ matrix.os }}-${{ github.sha }} | |
| restore-keys: ccache-${{ 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 | |
| CIBW_ARCHS_WINDOWS: AMD64 | |
| - 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 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 |