Support exporting python dependency metadata #363
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: Python CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: # allow manual triggering | |
| # Cancel in-progress runs for the same branch/PR when a new push arrives. | |
| # Omitted from release.yml — you never want to cancel an in-progress release. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| VICEROY_TAG: v0.16.4 | |
| WASM_TOOLS_VERSION: "1.250.0" | |
| jobs: | |
| lint_build_test: | |
| name: "Lint, Build & Test" | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Rust toolchains | |
| uses: ./.github/actions/setup-rust | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| run: pip install uv | |
| # Cache cargo binaries (viceroy, wasm-tools). | |
| # wasm-tools is required by scripts/generate_patches, which runs as part | |
| # of make lint to verify patches.py is up to date with the WIT sources. | |
| - name: Cache cargo binaries | |
| id: cache-cargo-bins | |
| uses: actions/cache@v4 | |
| with: | |
| key: cargo-bins-${{ runner.os }}-${{ env.VICEROY_TAG }}-wasm-tools-${{ env.WASM_TOOLS_VERSION }} | |
| path: | | |
| ~/.cargo/bin/viceroy* | |
| ~/.cargo/bin/wasm-tools* | |
| - name: Install wasm-tools | |
| if: steps.cache-cargo-bins.outputs.cache-hit != 'true' | |
| run: cargo install wasm-tools --version ${{ env.WASM_TOOLS_VERSION }} --locked | |
| - name: Install viceroy | |
| if: steps.cache-cargo-bins.outputs.cache-hit != 'true' | |
| run: cargo install --git https://github.com/fastly/Viceroy.git --tag "$VICEROY_TAG" viceroy | |
| # Cache Rust registry and git sources separately from build artifacts. | |
| # | |
| # Sources are keyed only on Cargo.lock so they survive a clean target/ | |
| # and are shared across build profiles (release, clippy, etc.). | |
| # | |
| # Build artifacts (target/) are cached separately per Cargo.lock AND | |
| # Rust toolchain version, because different toolchain versions produce | |
| # incompatible artifacts. | |
| - name: Cache Rust sources | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| ~/.cargo/git/checkouts/ | |
| key: cargo-sources-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-v1 | |
| restore-keys: | | |
| cargo-sources-${{ runner.os }}- | |
| # Build artifacts are cached per Cargo.lock + toolchain. We cache both | |
| # release and debug/clippy profiles together since they share most deps. | |
| - name: Cache Rust build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: target/ | |
| key: cargo-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUSTUP_TOOLCHAIN }}-v1 | |
| restore-keys: | | |
| cargo-target-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}- | |
| cargo-target-${{ runner.os }}- | |
| # Build the native extension in release mode first so the release | |
| # artifacts are in target/. Clippy reuses these artifacts for deps | |
| # that don't change between profiles. | |
| - name: Build native extension | |
| run: uv run maturin develop --release | |
| # Install Python dependencies | |
| - name: Install Python dependencies | |
| run: uv sync --extra dev --extra test --extra examples | |
| # Run clippy using the same --release flag and features as the build | |
| # above so that Cargo can reuse the already-compiled dependency | |
| # artifacts and only checks our own crate. | |
| - name: Check formatting | |
| run: make format-check | |
| - name: Run linting | |
| run: make lint | |
| - name: Run tests | |
| # Use DEV_MODE=0 to use the installed fastly-compute-py binary instead of rebuilding with cargo | |
| run: DEV_MODE=0 make test |