-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (139 loc) · 5.65 KB
/
Copy pathci.yml
File metadata and controls
164 lines (139 loc) · 5.65 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: CI
# Continuous integration for every push to `main` and every pull request.
#
# This is the day-to-day quality gate (the `publish.yml` workflow only fires on
# `v*` tags). It enforces formatting, lints, docs, the test suite, AND a
# **line-coverage floor of 80%** measured with `cargo llvm-cov`. A change that
# drops line coverage below 80% fails the build.
#
# Flaky-test management (#489): the test suite runs under `cargo nextest` with
# `--retries 2` so a test that fails then passes on retry is reported as FLAKY
# (surfaced in the run output / JUnit) rather than silently green or blocking
# the merge on transient flakiness. Coverage instrumentation still runs via
# `cargo llvm-cov nextest` so the 80% floor is measured the same way.
#
# Coverage notes:
# - Measured against the production-shaped **default** feature set
# (`native-tls,relay,erlay,compact-blocks,dandelion`). The `tor` and `rustls`
# features are opt-in and pull heavy / alternate-TLS dependencies, so they are
# not part of the coverage gate (their cfg-gated code is excluded from the
# default-feature report rather than counted as "uncovered").
# - `vendor/` (the patched chia-protocol / chia-sdk-client / native-tls crates)
# is excluded via `--ignore-filename-regex` — we only gate on our own `src/`.
# - Integration tests bind loopback TLS listeners; they run single-threaded
# (`--test-threads=1`) to match `publish.yml` and avoid port/handshake races.
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
lint:
name: Format, Clippy & Docs
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: 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
lock:
name: Cargo.lock in sync
# The version-drift guard (#1885). A PR that bumps Cargo.toml without re-locking leaves the
# lock's own entry for this crate behind, and `--locked` then fails for everyone — CI, a
# contributor on a clean checkout, and every consumer that resolves dig-gossip by git rev
# (this crate is git-dep'd, not on crates.io, so its lock is what consumers resolve against).
# `cargo metadata --locked` fails whenever the lock is not already a valid solution for the
# manifests, which is exactly that drift — and it needs no build, so it reports in seconds.
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Verify Cargo.lock matches Cargo.toml
run: cargo metadata --locked --format-version 1 > /dev/null
rustls-tests:
name: rustls inbound tests (Linux, #1371)
# The coverage job above measures the native-tls default feature set; the rustls inbound
# acceptor (#1371) is cfg-gated out of it. This job runs the rustls-feature test suite on Linux
# so the OpenSSL/Linux inbound cert-capture regression test actually executes on every PR.
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Run rustls-feature library tests
# `--lib` only: the integration-test binaries under `tests/` (con_001/con_002/…) are
# `required-features = ["native-tls"]` and are covered by the native-tls coverage job. The
# rustls inbound acceptor's regression test (#1371) lives in `src/connection/rustls_inbound.rs`
# and runs here so the OpenSSL/Linux cert-capture path is exercised on every PR.
run: >-
cargo test
--locked
--no-default-features
--features rustls,relay,erlay,compact-blocks,dandelion
--lib
--
--test-threads=1
coverage:
name: Test Suite + Coverage (>=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: 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: Run tests with coverage and enforce >=80% line coverage
run: >-
cargo llvm-cov nextest
--locked
--no-default-features
--features native-tls,relay,erlay,compact-blocks,dandelion
--ignore-filename-regex 'vendor/'
--fail-under-lines 80
--lcov --output-path lcov.info
--test-threads=1
--retries 2
- name: Coverage summary
if: always()
run: >-
cargo llvm-cov report
--ignore-filename-regex 'vendor/'
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: lcov.info
if-no-files-found: ignore