Skip to content

Update to fastly:compute/service@0.1.0. #129

Update to fastly:compute/service@0.1.0.

Update to fastly:compute/service@0.1.0. #129

Workflow file for this run

name: Python CI
on:
push: # Runs on pushes to all branches
pull_request:
branches:
- main
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
env:
VICEROY_TAG: v0.16.4
jobs:
build:
runs-on: forge-amd64-medium
steps:
- uses: actions/checkout@v4
- name: Get wasiless submodule
# Org-internal submodules are very tricky to check out.
env:
SSHK: ${{ secrets.WASILESS_REPO_READ_KEY }}
run: |
mkdir -p $HOME/.ssh
echo "$SSHK" > $HOME/.ssh/ssh.key
chmod 600 $HOME/.ssh/ssh.key
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/ssh.key"
git submodule update --init --recursive
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.92.0
target: wasm32-unknown-unknown
components: rustfmt, clippy
# Disable the built-in cargo cache - we'll use a more sophisticated setup below
cache: false
- name: Set up nightly Rust toolchain with rust-src
run: |
rustup toolchain install nightly --component rust-src
rustup target add wasm32-wasip1 --toolchain nightly
- 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, etc.)
- name: Cache cargo binaries
id: cache-cargo-bins
uses: actions/cache@v4
with:
key: cargo-bins-${{ runner.os }}-${{ env.VICEROY_TAG }}
path: |
~/.cargo/bin/viceroy*
~/.cargo/bin/wasm-tools*
~/.cargo/bin/wac*
- name: Install wasm-tools and wac
if: steps.cache-cargo-bins.outputs.cache-hit != 'true'
run: cargo install wasm-tools wac-cli
- 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 dependencies and build artifacts
# CRITICAL: ~/.cargo/git/checkouts/ contains componentize-py source + built CPython (5+ min build)
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
~/.cargo/git/checkouts/
target/
key: cargo-deps-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-v3
restore-keys: |
cargo-deps-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-
cargo-deps-${{ runner.os }}-
# Setup sccache for Rust compilation caching
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.8
- name: Configure sccache
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
# Build the Rust native extension (this is the slow part - builds componentize-py + CPython)
- 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
# Finally, do our final checks
- 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