name: Build on: [push, pull_request] jobs: pre-commit: name: Run pre-commit hooks runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: astral-sh/setup-uv@v7 - uses: actions/setup-python@v6 with: python-version-file: pyproject.toml - name: Install the project run: uv sync --locked --dev - name: Run pre-commit hooks uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd build-wheels: name: Build wheels for ${{ matrix.os }} runs-on: ${{ matrix.runs-on }} strategy: matrix: include: - os: linux-intel runs-on: ubuntu-latest - os: linux-arm runs-on: ubuntu-24.04-arm - os: windows-intel runs-on: windows-latest - os: macos-intel runs-on: macos-26-intel - os: macos-arm runs-on: macos-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Build wheels uses: pypa/cibuildwheel@v3.4.0 - uses: actions/upload-artifact@v7 with: name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl - name: Get coverage files if: matrix.os == 'linux-intel' id: get-coverage-files run: | FILES=$(find ./wheelhouse -type f -name '.coverage*' -printf '%p ') echo "Found coverage files: $FILES" echo "files=$FILES" >> $GITHUB_OUTPUT - name: Upload to Coveralls if: matrix.os == 'linux-intel' uses: coverallsapp/github-action@v2 with: files: ${{ steps.get-coverage-files.outputs.files }} build-sdist: name: Build source distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Build sdist run: pipx run build --sdist - uses: actions/upload-artifact@v7 with: name: cibw-sdist path: dist/*.tar.gz upload-pypi: name: Publish to PyPI needs: [pre-commit, build-wheels, build-sdist] runs-on: ubuntu-latest environment: pypi permissions: id-token: write if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') steps: - uses: actions/download-artifact@v8 with: pattern: cibw-* path: dist merge-multiple: true - uses: pypa/gh-action-pypi-publish@release/v1