name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache dev tool binaries (cargo-llvm-cov, cargo-audit, cargo-udeps)
id: cache-cargo-bin
uses: actions/cache@v6
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-llvm-cov-0.6.21-audit-0.22.2-udeps-0.1.61
- name: Update stable toolchain
if: steps.cache-cargo-bin.outputs.cache-hit != 'true'
run: rustup update stable
- name: Install cargo-llvm-cov
if: steps.cache-cargo-bin.outputs.cache-hit != 'true'
run: cargo install cargo-llvm-cov --version 0.6.21 --locked
- name: Install cargo-audit
if: steps.cache-cargo-bin.outputs.cache-hit != 'true'
run: cargo install cargo-audit --version 0.22.2 --locked
- name: Install cargo-udeps
if: steps.cache-cargo-bin.outputs.cache-hit != 'true'
run: cargo +stable install cargo-udeps --version 0.1.61 --locked
- name: Install pinned nightly toolchain and components
run: rustup component add --toolchain nightly-2025-10-12-x86_64-unknown-linux-gnu rustfmt clippy llvm-tools-preview
- name: pre-commit
uses: j178/prek-action@v1
- name: Test Build
env:
RUSTFLAGS: "-C target-feature=+crt-static"
run: cargo build
- name: Run tests with coverage
run: cargo llvm-cov --doctests --verbose --lcov --output-path lcov.info