release 0.2.0: expand CI wheel matrix, overhaul docs and SEO #22
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/CD | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| tags: | |
| - "v*" | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| publish_to_pypi: | |
| description: Publish to PyPI | |
| required: true | |
| type: boolean | |
| default: false | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref_type != 'tag' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Ruff check | |
| run: | | |
| pipx run ruff check --ignore F401 --exclude '*.pyi' . | |
| pipx run ruff format --check --exclude '*.pyi' . | |
| - name: Cargo fmt | |
| run: cargo fmt --check | |
| - name: Cargo clippy | |
| run: cargo clippy --all-targets -- -D warnings | |
| # ------------------------------------------------------------------ | |
| # Wheels: Linux (glibc) — x86_64, x86, aarch64, armv7, s390x, ppc64le | |
| # ------------------------------------------------------------------ | |
| linux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| 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.11" | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| manylinux: auto | |
| sccache: "true" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }} | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Wheels: Linux (musl / Alpine) — x86_64, x86, aarch64, armv7 | |
| # ------------------------------------------------------------------ | |
| musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| 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.11" | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| manylinux: musllinux_1_2 | |
| sccache: "true" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-musllinux-${{ matrix.platform.target }} | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Wheels: Windows — x64, x86, arm64 | |
| # ------------------------------------------------------------------ | |
| windows: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| python-arch: x64 | |
| - runner: windows-latest | |
| target: x86 | |
| python-arch: x86 | |
| - runner: windows-11-arm | |
| target: aarch64 | |
| python-arch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| architecture: ${{ matrix.platform.python-arch }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| sccache: "true" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-windows-${{ matrix.platform.target }} | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Wheels: macOS — Intel (x86_64) & Apple Silicon (aarch64) | |
| # ------------------------------------------------------------------ | |
| macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - runner: macos-13 | |
| target: x86_64 | |
| - runner: macos-14 | |
| target: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| sccache: "true" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }} | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Wheels: PyPy (3.9 / 3.10) — Linux, Windows, macOS | |
| # ------------------------------------------------------------------ | |
| pypy: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64 | |
| - runner: ubuntu-22.04 | |
| target: aarch64 | |
| - runner: windows-latest | |
| target: x64 | |
| - runner: macos-13 | |
| target: x86_64 | |
| - runner: macos-14 | |
| target: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # On Linux, PyPy interpreters ship inside the manylinux container, | |
| # so setup-python is only needed on Windows/macOS. | |
| - uses: actions/setup-python@v5 | |
| if: runner.os != 'Linux' | |
| with: | |
| python-version: | | |
| pypy3.9 | |
| pypy3.10 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --interpreter pypy3.9 pypy3.10 | |
| manylinux: auto | |
| sccache: "true" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-pypy-${{ runner.os }}-${{ matrix.platform.target }} | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Source distribution | |
| # ------------------------------------------------------------------ | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| # ------------------------------------------------------------------ | |
| # Test the built abi3 wheels across CPython 3.8 – 3.13 | |
| # ------------------------------------------------------------------ | |
| test: | |
| name: test (${{ matrix.platform.runner }}, py${{ matrix.python-version }}) | |
| needs: | |
| - linux | |
| - windows | |
| - macos | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - runner: ubuntu-latest | |
| artifact: wheels-linux-x86_64 | |
| - runner: windows-latest | |
| artifact: wheels-windows-x64 | |
| - runner: macos-14 | |
| artifact: wheels-macos-aarch64 | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| exclude: | |
| # setup-python has no CPython 3.8/3.9 builds for Apple Silicon | |
| - platform: | |
| runner: macos-14 | |
| python-version: "3.8" | |
| - platform: | |
| runner: macos-14 | |
| python-version: "3.9" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.artifact }} | |
| path: dist | |
| - name: Install wheel | |
| run: | | |
| pip install ciphertoken --no-index --find-links dist --force-reinstall | |
| pip install pytest pytest-asyncio | |
| - name: Run tests | |
| run: pytest | |
| # ------------------------------------------------------------------ | |
| # Publish to PyPI (on v* tags, or manually via workflow_dispatch) | |
| # ------------------------------------------------------------------ | |
| publish: | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') || inputs.publish_to_pypi }} | |
| needs: | |
| - lint | |
| - test | |
| - linux | |
| - musllinux | |
| - windows | |
| - macos | |
| - pypy | |
| - sdist | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true | |
| # ------------------------------------------------------------------ | |
| # GitHub Release with all artifacts attached (on v* tags) | |
| # ------------------------------------------------------------------ | |
| github-release: | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| needs: | |
| - publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: dist/* | |
| generate_release_notes: true |