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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Copyright 2026 H0llyW00dzZ
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ๐งช Test Coverage
on:
push:
branches:
paths-ignore:
- '**/*.md'
- 'LICENSE'
- '.gitignore'
- '.ignore'
- '.github/dependabot.yml'
pull_request:
branches:
paths-ignore:
- '**/*.md'
- 'LICENSE'
- '.gitignore'
- '.ignore'
- '.github/dependabot.yml'
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
coverage:
name: ๐ข Test Coverage on ${{ matrix.os }} (Rust ${{ matrix.rust }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Minimal high-signal matrix.
#
# What we exclude and why:
# - macos-latest: dtolnay/rust-toolchain@master keeps leaving a
# half-installed cargo shim on Apple Silicon runners. Apple-Silicon
# users will run their own builds locally; CI fighting the image is
# wasted time.
# - ubuntu-22.04: older rustup tooling does not cleanly fetch our
# edition-2024 MSRV (1.85.0).
# - ubuntu-*-arm: aws-lc-sys glibc 2.38+ C23 symbol mismatch
# (`__isoc23_sscanf`, `__isoc23_strtol`).
# - windows-2022 / windows-11-arm: redundant with windows-latest for
# a pure-Rust HTTP crate; image differences rarely surface bugs.
# - beta / nightly: not load-bearing. Re-add as scheduled jobs if you
# want early-warning signal on upcoming Rust regressions.
include:
- # MSRV compile check
- # full lint + test + coverage
- # catch path/CRLF bugs
steps:
- name: Checkout code
uses: actions/checkout@v6
# Canonical dtolnay usage: `@master` is the action ref, and the actual
# Rust version comes from `with: toolchain:`. This is the pattern the
# action's README recommends.
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy, llvm-tools-preview
# Belt-and-suspenders for macOS: dtolnay/rust-toolchain@master has been
# observed to "succeed" on macos-latest (Apple Silicon) while leaving
# cargo as a half-initialized rustup-init shim. That makes the very
# next `cargo build` fail with "unexpected argument 'build'" before
# any real work runs.
#
# We verify cargo actually responds to `--version`; if not, we
# bootstrap rustup ourselves, set the requested toolchain as default,
# and re-add ~/.cargo/bin to PATH for the rest of the job.
- name: Verify Rust install and self-heal if broken
shell: bash
run: |
set -euo pipefail
# Make sure subsequent steps see ~/.cargo/bin first.
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
export PATH="$HOME/.cargo/bin:$PATH"
if cargo --version >/dev/null 2>&1 && rustc --version >/dev/null 2>&1; then
echo "::notice::cargo + rustc are working; dtolnay install OK."
cargo --version
rustc --version
rustup show || true
exit 0
fi
echo "::warning::cargo/rustc not usable after dtolnay install; bootstrapping manually."
which cargo || true
which rustc || true
# Install rustup itself (no toolchain yet) only if it's missing.
if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain none --profile minimal
fi
rustup toolchain install "${{ matrix.rust }}" \
--profile minimal \
--component rustfmt \
--component clippy \
--component llvm-tools-preview
rustup default "${{ matrix.rust }}"
# Fail loudly if it still doesn't work.
cargo --version
rustc --version
rustup show
- name: Cache cargo registry and build artifacts
uses: Swatinem/rust-cache@v2
# Run formatting and clippy only on one canonical runner so we don't
# block on stylistic noise across the matrix.
- name: Check formatting
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
run: cargo fmt --all -- --check
- name: Run clippy
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
run: cargo clippy --all-targets --all-features -- -D warnings
# MSRV (1.85.0) only needs to *compile* the library + examples. We do
# not run tests on MSRV because newer dev-dependencies may transitively
# require a higher toolchain; `cargo build` does not resolve dev-deps.
- name: MSRV build check
if: ${{ matrix.rust == '1.85.0' }}
run: cargo build --all-features --all-targets --verbose
- name: Build
if: ${{ matrix.rust != '1.85.0' }}
run: cargo build --all-features --all-targets --verbose
- name: Run tests
if: ${{ matrix.rust != '1.85.0' }}
run: cargo test --all-features --all-targets --verbose
# โโ Coverage (single canonical runner only) โโโโโโโโโโโโโโโโโโโโโโโโโโ
- name: Install cargo-llvm-cov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Run tests with coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Run doc tests
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
run: cargo test --doc --all-features
- name: Upload coverage to Codecov
if: ${{ matrix.os == 'ubuntu-latest' && matrix.rust == 'stable' }}
uses: codecov/codecov-action@v6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./lcov.info
flags: unittests
name: codecov-umbrella