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
name: CI
on:
push:
branches:
pull_request:
branches:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
RUSTFLAGS: -Dwarnings
jobs:
test:
name: Test & lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: rustfmt, clippy
- run: cargo fmt --check
- run: cargo clippy --all-targets --all-features
- run: cargo clippy --all-targets # default (no_std) feature set
- run: cargo test --all-features
- name: no_std build
run: cargo build
deny:
name: cargo-deny (bans/licenses/sources)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1 # v2.0.4
with:
command: check bans licenses sources
advisories:
name: cargo-deny (advisories)
runs-on: ubuntu-latest
# Informational: a malformed entry in the upstream RustSec advisory-db breaks
# DB *loading* for the whole ecosystem and must not gate our build. Real
# advisories against our (zero-dependency) tree still surface here.
continue-on-error: true
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: EmbarkStudios/cargo-deny-action@34899fc7ba81ca6268d5947a7a16b4649013fea1 # v2.0.4
with:
command: check advisories
coverage:
name: Coverage (100% lib)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Gate on 100% line coverage (excluding // cov:unreachable)
run: |
cargo llvm-cov --all-features --lib --lcov --output-path lcov.info
# Fail on any DA:<line>,0 whose source line lacks a `// cov:unreachable`
# marker (the fleet defence-in-depth exemption).
fail=0
while IFS= read -r entry; do
line="${entry#DA:}"; line="${line%,0}"
src=$(sed -n "${line}p" src/lib.rs)
case "$src" in
*cov:unreachable*) ;;
*) echo "Uncovered (no cov:unreachable): src/lib.rs:${line}: ${src}"; fail=1 ;;
esac
done < <(grep -E '^DA:[0-9]+,0$' lcov.info || true)
exit $fail