name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
ci:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
- name: Format (check)
run: cargo fmt --all -- --check
- name: Clippy (deny warnings)
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Unit + integration tests
run: cargo test --all-features
- name: Doctests (rustdoc)
run: cargo test --doc
wasm:
name: WASM (fugue-wasm)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Rust (wasm32 target)
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: wasm
- name: Check WASM crate compiles for wasm32
run: cargo check -p fugue-wasm --target wasm32-unknown-unknown
- name: Native tests (DSL + interpreter)
run: cargo test -p fugue-wasm
- name: WASM boundary tests (Node)
run: wasm-pack test --node crates/fugue-wasm
- name: Build WASM package
run: wasm-pack build crates/fugue-wasm --target web --release
msrv:
name: MSRV (1.87.0)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Rust 1.87.0 (MSRV)
uses: dtolnay/rust-toolchain@1.87.0
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: . -> target
key: msrv-1.87.0
- name: Scope the manifest to the published library
run: |
# MSRV is a claim about the *published library* (`[dependencies]`),
# not about maintainer tooling in `[dev-dependencies]` (mdbook + its
# plugins, criterion, proptest, ...): those crates have their own,
# higher MSRV floors and are never pulled in by a downstream
# `cargo add fugue-ppl`. This is an ephemeral CI checkout, so
# truncating the manifest at `[dev-dependencies]` here commits
# nothing back and only scopes *this* check to what actually ships.
sed -i '/^\[dev-dependencies\]/,$d' Cargo.toml
# Same reasoning for crates/fugue-wasm: it is an unpublished
# bindings crate (wasm-bindgen tooling has its own MSRV floor) and
# is never part of a downstream `cargo add fugue-ppl`. Drop it from
# the workspace so its dependency graph doesn't enter resolution.
sed -i 's#, "crates/fugue-wasm"##' Cargo.toml
# The committed Cargo.lock may be a newer lock-file format than an
# older cargo/rustc pair can parse; regenerating against the
# trimmed manifest above is required (and sufficient -- verified
# locally: `[dependencies]` resolves and builds cleanly on
# rustc 1.87.0 with no other changes, and `cargo clippy
# --all-targets --all-features` with `rust-version = "1.87"` finds
# zero `incompatible_msrv` diagnostics anywhere in the crate).
rm -f Cargo.lock
- name: cargo check --lib (rustc 1.87.0)
run: cargo check --lib