Build and release #45
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 release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| target: | |
| description: 'Release target' | |
| required: true | |
| default: 'test' | |
| jobs: | |
| build_wheels: | |
| name: Build ${{ matrix.python }} wheels on ${{ matrix.os }}-${{ matrix.platform_id }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: | |
| - "310" | |
| - "311" | |
| - "312" | |
| - "313" | |
| - "314" | |
| platform_id: | |
| - macosx_universal2 | |
| - manylinux_x86_64 | |
| - manylinux_aarch64 | |
| - win_amd64 | |
| include: | |
| # Linux | |
| - platform_id: manylinux_x86_64 | |
| os: ubuntu-latest | |
| - platform_id: manylinux_aarch64 | |
| os: ubuntu-latest | |
| # macOS | |
| - platform_id: macosx_universal2 | |
| os: macos-latest | |
| # Windows | |
| - platform_id: win_amd64 | |
| os: windows-latest | |
| env: | |
| CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} | |
| CIBW_ARCHS_LINUX: auto aarch64 | |
| CIBW_ARCHS_MACOS: universal2 | |
| CIBW_TEST_REQUIRES: pytest==9.* hypothesis==6.* typing-extensions==4.* | |
| CIBW_TEST_COMMAND: "bash {project}/tools/test_wheels.sh {project}" | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
| CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU (Linux aarch64) | |
| if: runner.os == 'Linux' && matrix.platform_id == 'manylinux_aarch64' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.3.1 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.platform_id }}-${{ matrix.python }} | |
| path: ./wheelhouse/*.whl | |
| build_dist: | |
| name: Build source distribution and pure python wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build | |
| - name: Build sdist | |
| run: python -m build --sdist | |
| - name: Build pure wheel | |
| run: python -m build --wheel | |
| env: | |
| PYRSISTENT_SKIP_EXTENSION: yes | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/* | |
| publish_pypi: | |
| needs: [build_wheels, build_dist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: '*' | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish test release | |
| if: github.event.inputs.target == 'test' | |
| uses: pypa/gh-action-pypi-publish@v1.12.4 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| repository_url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| - name: Publish release | |
| if: github.event.inputs.target != 'test' | |
| uses: pypa/gh-action-pypi-publish@v1.12.4 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |