name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-24.04-arm, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test (unit + integration + doc, every feature)
run: cargo test --all-features
- name: Test (unit + integration + doc, default features)
run: cargo test
- name: Test (lib unit tests, no_std)
run: cargo test --lib --no-default-features
- name: Test (lib unit tests, no_std + law)
run: cargo test --lib --no-default-features --features law
- name: Example (residual_summary, law feature)
run: cargo run --example residual_summary --features law
no-std:
name: Build (no_std, host + thumbv7em-none-eabihf)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- name: Add thumbv7em-none-eabihf
run: rustup target add thumbv7em-none-eabihf
- uses: Swatinem/rust-cache@v2
- name: Check (lib, no_std, host)
run: cargo check --lib --no-default-features
- name: Check (lib, no_std + law, host)
run: cargo check --lib --no-default-features --features law
- name: Build (lib, no_std, thumbv7em-none-eabihf)
run: cargo build --lib --no-default-features --target thumbv7em-none-eabihf
- name: Build (lib, no_std + law, thumbv7em-none-eabihf)
run: cargo build --lib --no-default-features --features law --target thumbv7em-none-eabihf
- name: Clippy (lib, no_std + law, thumbv7em-none-eabihf)
run: cargo clippy --lib --no-default-features --features law --target thumbv7em-none-eabihf -- -W clippy::pedantic -D warnings
feature-powerset:
name: Feature powerset (cargo-hack, depth 2)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@v2
with:
tool: cargo-hack
- name: cargo hack check (lib, feature powerset, depth 2)
run: cargo hack check --lib --feature-powerset --depth 2
clippy:
name: Clippy (pedantic, -D warnings)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Clippy (default features, all targets)
run: cargo clippy --all-targets -- -W clippy::pedantic -D warnings
- name: Clippy (all features, all targets)
run: cargo clippy --all-targets --all-features -- -W clippy::pedantic -D warnings
msrv:
name: MSRV (rust-version = 1.87)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@1.87
- uses: Swatinem/rust-cache@v2
- name: cargo check on MSRV (lib, default features)
run: cargo +1.87 check --lib
- name: cargo check on MSRV (lib, all features)
run: cargo +1.87 check --lib --all-features
doc:
name: Doc (RUSTDOCFLAGS=-Dwarnings)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: cargo doc (no-deps, default features)
run: cargo doc --lib --no-deps
env:
RUSTDOCFLAGS: "-Dwarnings"
- name: cargo doc (no-deps, all features)
run: cargo doc --lib --no-deps --all-features
env:
RUSTDOCFLAGS: "-Dwarnings"
docs-lint:
name: Docs lint (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Docs lint (tests)
run: python scripts/test_docs_lint.py
- name: Docs lint (public documents, CHANGELOG structure)
run: python scripts/docs_lint.py --check
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
actionlint:
name: actionlint (workflow YAML)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Run actionlint
uses: reviewdog/action-actionlint@v1
with:
fail_level: error
reporter: github-check