name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build-test:
name: Build, Test & Lint (Rust)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy, llvm-tools-preview
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests with coverage (gate >= 80%)
run: cargo llvm-cov nextest --fail-under-lines 80 --all-features --workspace --lcov --output-path lcov.info --retries 2
- name: Coverage summary
if: always()
run: cargo llvm-cov report --summary-only
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: lcov-coverage
path: lcov.info
if-no-files-found: warn
- name: Check documentation
run: cargo doc --no-deps --all-features