name: Rust CI
on:
push:
branches: [main]
paths-ignore: ['lean/**', '*.md', 'paper/**', 'blog/**']
pull_request:
branches: [main]
paths-ignore: ['lean/**', '*.md', 'paper/**', 'blog/**']
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-03-19
components: rustfmt
- name: Format check
run: cargo fmt --check
- name: Build
run: cargo build --workspace --verbose
- name: Unit tests
run: cargo test --workspace --lib --verbose
- name: Unit tests (all features)
run: cargo test --workspace --lib --all-features --verbose
- name: Doc tests
run: cargo test --doc --verbose
- name: Example tests
run: cargo test --examples --verbose
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2026-03-19
components: clippy, rustfmt
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
toolchain-freshness:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check toolchain pin is less than 90 days old
run: |
PIN=$(grep '^channel' rust-toolchain.toml | grep -oP '\d{4}-\d{2}-\d{2}' || true)
if [ -z "$PIN" ]; then
echo "::warning::No date found in rust-toolchain.toml channel pin — cannot check freshness."
exit 0
fi
PIN_EPOCH=$(date -d "$PIN" +%s)
NOW_EPOCH=$(date +%s)
AGE_DAYS=$(( (NOW_EPOCH - PIN_EPOCH) / 86400 ))
echo "Pinned nightly: $PIN ($AGE_DAYS days old)"
if [ "$AGE_DAYS" -gt 90 ]; then
echo "::error::Toolchain pin '$PIN' is $AGE_DAYS days old (>90). Update rust-toolchain.toml and ci.yml."
exit 1
fi