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
72
73
74
75
76
77
78
79
80
81
82
name: CI
on:
push:
branches:
pull_request:
branches:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
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
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- 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
# nextest runs each test as its own process and natively detects+reports
# flaky tests (failed-then-passed-on-retry) instead of silently hiding
# them. `--test-threads=1` mirrors the prior serial run (some integration
# tests assume serial execution).
- name: Run tests (nextest, flaky-aware)
run: cargo nextest run --all-features --retries 2 --test-threads=1
- name: Check documentation
run: cargo doc --no-deps --all-features
coverage:
name: Coverage (>=80% lines, gated)
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: 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
# Measure line coverage and FAIL the build if it drops below 80%.
# `cargo llvm-cov nextest` runs the flaky-aware nextest runner under
# coverage instrumentation so coverage is still collected (running
# `cargo nextest run` and `cargo llvm-cov` as separate steps collects
# zero coverage and always fails the gate). `--test-threads 1` mirrors
# the serial run used by the test suite (some integration tests assume
# serial execution) — passed as a native nextest flag, NOT after `--`
# (nextest rejects `--test-threads=1` forwarded to the test binary). A
# summary report is printed; the gate is enforced by
# `--fail-under-lines 80`.
- name: Run coverage with 80% line gate
run: cargo llvm-cov nextest --all-features --workspace --fail-under-lines 80 --retries 2 --test-threads 1