name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Lint, build, test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry and target
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: cargo fmt --check
run: cargo fmt --all -- --check
- name: cargo clippy (all targets, deny warnings)
run: cargo clippy --all-targets -- -D warnings
- name: cargo test (release, offline only)
run: cargo test --release
- name: cargo doc (no deps, deny warnings)
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
- name: cargo publish --dry-run
run: cargo publish --dry-run