1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: CI
# Runs on every push to main and on every pull request — the coverage
# gate (cargo-llvm-cov, --fail-under-lines 80) lives here so it guards
# day-to-day development. publish.yml stays tag-only for crates.io.
on:
push:
branches:
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Lint, test & coverage gate (≥80%)
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: Check formatting
run: cargo fmt --all -- --check
- name: Check clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Check documentation
run: cargo doc --no-deps --all-features
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
# The existing suite shares process-global state and must run
# single-threaded (see .config/nextest.toml: test-threads = 1); flaky
# tests get 2 retries (surfaced, not silently hidden — a test still
# failing after retries fails the build) via nextest's retry config.
# cargo-llvm-cov drives nextest directly so coverage is still
# collected in the SAME run — never run nextest and llvm-cov as
# separate steps, that collects zero coverage and fails the gate.
# --fail-under-lines 80 fails the build below the coverage floor.
- name: Run tests with coverage + flaky-retry gate (≥80% lines)
run: >
cargo llvm-cov nextest --all-features --workspace
--lcov --output-path lcov.info
--fail-under-lines 80
- 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: ignore