name: CI
on:
push:
branches: [main]
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/ci.yml"
- "rust-toolchain.toml"
- "justfile"
pull_request:
paths:
- "**/*.rs"
- "Cargo.toml"
- "Cargo.lock"
- ".github/workflows/ci.yml"
- "rust-toolchain.toml"
- "justfile"
merge_group:
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup show
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo fmt --check
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup show
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --all-targets --all-features -- -D warnings
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup show
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo check --all-targets --all-features
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup show
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo test