name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -C debuginfo=0
jobs:
test:
name: Test (${{ matrix.rust }})
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, beta, 1.88.0] steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Enable sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Start sccache locally (no GHA cache)
run: |
echo "SCCACHE_GHA_ENABLED=off" >> $GITHUB_ENV
sccache --start-server && echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV || echo "sccache unavailable, proceeding without it"
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose
- name: Build documentation
run: cargo doc --no-deps --all-features
- name: Run tests
run: cargo test --verbose
- name: Check formatting
if: matrix.rust == 'stable'
run: cargo fmt --all -- --check
- name: Run clippy
if: matrix.rust == 'stable'
run: cargo clippy --all-targets --all-features -- -D warnings