name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: Test (Rust ${{ matrix.rust }})
runs-on: ubuntu-latest
strategy:
matrix:
rust: [stable, '1.85']
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --verbose
- name: Run clippy
if: matrix.rust == 'stable'
run: |
rustup component add clippy
cargo clippy -- -D warnings
- name: Check formatting
if: matrix.rust == 'stable'
run: |
rustup component add rustfmt
cargo fmt -- --check