Update package metadata and Read the Docs build configuration #70
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
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| check-release-version: | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Verify tag matches Cargo.toml version | |
| run: | | |
| TAG="${GITHUB_REF_NAME#v}" | |
| VERSION="$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -n1)" | |
| test "$TAG" = "$VERSION" | |
| test: | |
| strategy: | |
| matrix: | |
| runs-on: [ ubuntu-latest, windows-latest, macos-latest ] | |
| python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ] | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build package | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| manylinux: auto | |
| args: -i ${{ matrix.python-version }} --release | |
| - name: Test package | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt zstandard | |
| python -c "import zstandard;zstandard.ZstdDecompressor().copy_stream(open('tests/data/system.dic.zst','rb'),open('tests/data/system.dic','wb'))" | |
| pip install vibrato --no-index --find-links target/wheels --force-reinstall | |
| mypy --strict tests | |
| pytest | |
| python -m doctest README.md | |
| python -m doctest docs/source/examples.rst | |
| pack-sdist: | |
| needs: [ check-release-version, test ] | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build package | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sdist | |
| path: target/wheels | |
| pack-linux: | |
| needs: [ check-release-version, test ] | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [ x86_64, i686 ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build package | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: auto | |
| args: -i 3.10 --release | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-linux-${{ matrix.target }} | |
| path: target/wheels | |
| pack-windows: | |
| needs: [ check-release-version, test ] | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| target: [ x64, x86 ] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| architecture: ${{ matrix.target }} | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build package | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: -i 3.10 --release | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-windows-${{ matrix.target }} | |
| path: target/wheels | |
| pack-macos: | |
| needs: [ check-release-version, test ] | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Build package | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| args: -i 3.10 --release --target universal2-apple-darwin | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-macos-universal2 | |
| path: target/wheels | |
| release: | |
| name: Release | |
| if: "startsWith(github.ref, 'refs/tags/')" | |
| needs: [ pack-sdist, pack-linux, pack-windows, pack-macos ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | |
| - name: Publish to PyPI | |
| run: uv publish --trusted-publishing always wheels-*/* sdist/* |