Add Great Docs site (including workflow file) #92
Workflow file for this run
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
| # Based on `maturin generate-ci github` output. | |
| # | |
| # This workflow is intentionally customized to also build/test PyPy wheels alongside the default | |
| # CPython (abi3) builds, so it is not a pure generated artifact. | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: x86 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| - runner: ubuntu-22.04 | |
| target: armv7 | |
| - runner: ubuntu-22.04 | |
| target: s390x | |
| - runner: ubuntu-22.04 | |
| target: ppc64le | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| manylinux: auto | |
| - name: Test wheel + type checks | |
| if: ${{ matrix.platform.target == 'x86_64' }} | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U pytest mypy pyright | |
| # `--find-interpreter` may build PyPy wheels too; only install CPython wheels here. | |
| python -m pip install dist/*cp*.whl | |
| python -m pytest tests_py | |
| - uses: actions/setup-python@v5 | |
| if: ${{ matrix.platform.target == 'x86_64' }} | |
| with: | |
| python-version: pypy-3.11 | |
| - name: Test PyPy wheel | |
| if: ${{ matrix.platform.target == 'x86_64' }} | |
| shell: bash | |
| run: | | |
| if ! ls dist/*pp*.whl 1> /dev/null 2>&1; then | |
| echo "No PyPy wheel found; skipping." | |
| exit 0 | |
| fi | |
| python -m pip install -U pip | |
| python -m pip install -U pytest | |
| python -m pip install dist/*pp*.whl | |
| python -m pytest tests_py -k "not typechecks" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }} | |
| path: dist | |
| musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: x86 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| - runner: ubuntu-22.04 | |
| target: armv7 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| manylinux: musllinux_1_2 | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-musllinux-${{ matrix.platform.target }} | |
| path: dist | |
| windows: | |
| runs-on: ${{ matrix.platform.runner }} | |
| env: | |
| # rustc's default ~1MB stack overflows on i686 Windows for heavy macro/type | |
| # expansion (seen during maturin builds). Bump to keep builds stable. | |
| RUST_MIN_STACK: 16777216 | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| - runner: windows-latest | |
| target: x86 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| architecture: ${{ matrix.platform.target }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| - name: Test wheel + type checks | |
| if: ${{ matrix.platform.target == 'x64' }} | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U pytest mypy pyright | |
| # `--find-interpreter` may build PyPy wheels too; only install CPython wheels here. | |
| python -m pip install dist/*cp*.whl | |
| python -m pytest tests_py | |
| - uses: actions/setup-python@v5 | |
| if: ${{ matrix.platform.target == 'x64' }} | |
| with: | |
| python-version: pypy-3.11 | |
| architecture: ${{ matrix.platform.target }} | |
| - name: Build PyPy wheel | |
| if: ${{ matrix.platform.target == 'x64' }} | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --interpreter python | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| - name: Test PyPy wheel | |
| if: ${{ matrix.platform.target == 'x64' }} | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U pytest | |
| python -m pip install dist/*pp*.whl | |
| python -m pytest tests_py -k "not typechecks" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-${{ matrix.platform.target }} | |
| path: dist | |
| macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: macos-14 | |
| target: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: pypy-3.11 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.x | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --find-interpreter | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| - name: Test wheel + type checks | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U pytest mypy pyright | |
| # `--find-interpreter` may build PyPy wheels too; only install CPython wheels here. | |
| python -m pip install dist/*cp*.whl | |
| python -m pytest tests_py | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: pypy-3.11 | |
| - name: Test PyPy wheel | |
| shell: bash | |
| run: | | |
| python -m pip install -U pip | |
| python -m pip install -U pytest | |
| python -m pip install dist/*pp*.whl | |
| python -m pytest tests_py -k "not typechecks" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }} | |
| path: dist | |
| emscripten: | |
| runs-on: ubuntu-22.04 | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| # pyodide-build currently lags new CPython releases; pin to a supported version. | |
| python-version: "3.13" | |
| - run: pip install pyodide-build | |
| - name: Get Emscripten and Python version info | |
| shell: bash | |
| run: | | |
| echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV | |
| echo PYTHON_VERSION=$(pyodide config get python_version | cut -d '.' -f 1-2) >> $GITHUB_ENV | |
| pip uninstall -y pyodide-build | |
| - uses: mymindstorm/setup-emsdk@v12 | |
| with: | |
| version: ${{ env.EMSCRIPTEN_VERSION }} | |
| # Avoid `actions-cache-folder`: the action uses a shared cache key and can fail | |
| # with "Unable to reserve cache…" when multiple workflow runs race to save it. | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - run: pip install pyodide-build | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: wasm32-unknown-emscripten | |
| args: --release --out dist -i ${{ env.PYTHON_VERSION }} | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| rust-toolchain: nightly | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wasm-wheels | |
| path: dist | |
| if-no-files-found: warn | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
| needs: [linux, musllinux, windows, macos, sdist] | |
| environment: pypi | |
| permissions: | |
| # Use to sign the release artifacts | |
| id-token: write | |
| # Used to upload release artifacts | |
| contents: write | |
| # Used to generate artifact attestation | |
| attestations: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: 'wheels-*/*' | |
| - name: Publish to PyPI | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing wheels-*/* |