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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on:
push:
branches:
pull_request:
branches:
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
# Coverage MUST be collected via the combined `cargo llvm-cov nextest` form so llvm-cov
# drives nextest directly -- never run `cargo nextest run` and `cargo llvm-cov` as two
# separate steps, that collects zero coverage (the exact bug this fixes, #489).
#
# `--no-tests=warn`: today this crate's only test file (tests/parity.rs) is a live-network
# `#[ignore]`d comparison suite (run manually with `--ignored` against mainnet), so a normal
# nextest run matches ZERO tests. Nextest's default `--no-tests` behavior is a HARD ERROR
# ("no tests to run", exit 4) in that case, which fails the job before coverage is even
# measured. `warn` makes "no tests matched" a warning instead of a failure so the (currently
# empty) coverage report still generates and uploads.
#
# Coverage is measure-only for now: the active unit-test suite is still being built out
# (tracked in #157). It is NOT yet gated at >= 80% lines -- with zero non-ignored tests today,
# a `--fail-under-lines 80` gate would fail every PR unconditionally. Once the real unit-test
# suite lands (#157), flip this to the gated form: `cargo llvm-cov nextest --fail-under-lines 80
# --all-features --workspace --lcov --output-path lcov.info --retries 2`.
#
# Runs via nextest with retries so a test that fails-then-passes is reported as FLAKY
# (not a hard failure) instead of silently passing or blocking the build (#489).
- name: Run tests with coverage (measure-only)
run: cargo llvm-cov nextest --all-features --workspace --lcov --output-path lcov.info --retries 2 --no-tests=warn
- 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
wasm-coinset:
name: Build & lint (wasm32 coinset-only)
runs-on: ubuntu-latest
# Proves the coinset REST tier stays wasm-clean: no native HTTP, no blst,
# no getrandom leak, none of the peer/CLVM stack reaches the wasm build.
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain (wasm32 target)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: wasm32-unknown-unknown
components: clippy
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Build coinset-only for wasm32
run: cargo build --target wasm32-unknown-unknown --no-default-features --features coinset
- name: Clippy coinset-only for wasm32
run: cargo clippy --target wasm32-unknown-unknown --no-default-features --features coinset -- -D warnings