CI: Build Wheels #6
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: "CI: Build Wheels" | |
| on: | |
| workflow_dispatch: | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.archs }} for ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Select architecture for MacOS | |
| run: | | |
| echo 'CIBW_ARCHS=x86_64 universal2' >> $GITHUB_ENV | |
| if: runner.os == 'macOS' | |
| - uses: pypa/[email protected] | |
| name: Build wheels | |
| env: | |
| # cibuildwheel will build wheel once and test it for each CPython version | |
| CIBW_BUILD: "cp312-* cp313-* cp311-* cp310-*" | |
| # musllinux is not supported since musl does not export _timezone | |
| CIBW_SKIP: "*musllinux*" | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: ./wheelhouse/*.whl | |
| upload_all: | |
| needs: [build_wheels] | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| pattern: cibw-* | |
| path: dist | |
| merge-multiple: true | |
| - uses: pypa/[email protected] |