name: CI
on:
push:
branches:
pull_request:
# Cancel superseded runs for the same ref to save CI minutes.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Least privilege: this workflow only reads the repository.
permissions:
contents: read
jobs:
check:
name: fmt + clippy + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# rustup honors rust-toolchain.toml (channel + rustfmt/clippy components)
# on the first cargo invocation, so no explicit toolchain step is needed.
- name: Cache cargo build
uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --check
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Test
run: cargo test