name: Format and Clippy
on:
push:
branches:
- main
paths-ignore:
- 'nix/**'
- 'flake.nix'
- 'flake.lock'
- 'README.md'
pull_request:
paths-ignore:
- 'nix/**'
- 'flake.nix'
- 'flake.lock'
- 'README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
clippy:
name: Clippy (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain with Clippy
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "ci-${{ matrix.os }}"
- name: cargo clippy (default features)
run: cargo clippy --workspace --locked -- -D warnings
- name: cargo clippy (no default features)
run: cargo clippy --workspace --locked --no-default-features -- -D warnings
- name: cargo clippy (all features)
run: cargo clippy --workspace --locked --all-features -- -D warnings
fmt:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install stable Rust toolchain with rustfmt
uses: dtolnay/rust-toolchain@stable
- name: cargo fmt --check
run: cargo fmt --all --check