name: Tests
on:
push:
pull_request:
workflow_dispatch:
workflow_call:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
env:
CLIPPY_ARGS: "1"
run: |
cargo clippy --all-targets --no-default-features --features no-build-database -- -D warnings
- name: Run tests
run: |
cargo test --verbose --no-default-features --features no-build-database
cargo test --doc --verbose --no-default-features --features no-build-database