name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build-test:
name: Build & Test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: stable-${{ matrix.os }}
- name: Build
run: cargo build
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Format
run: cargo fmt --check
- name: Test
run: cargo test
docs:
name: Rustdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: stable-docs
- name: Check docs
env:
RUSTDOCFLAGS: "-D warnings"
run: cargo doc --no-deps
msrv:
name: MSRV (1.91)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (1.91.0)
uses: dtolnay/rust-toolchain@1.91.0
with:
components: clippy
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: msrv-1.91
- name: Check build on MSRV
run: cargo +1.91.0 build
- name: Test on MSRV
run: cargo +1.91.0 test
audit:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: stable-audit
- name: Generate lockfile
run: cargo generate-lockfile
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Audit
run: cargo audit --ignore RUSTSEC-2026-0194 --ignore RUSTSEC-2026-0195
publish-dry-run:
name: Publish (dry-run)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: stable-publish
- name: cargo publish --dry-run
run: cargo publish --dry-run --allow-dirty