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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# Reusable test workflow: fmt, clippy, docs, audit, and the full test suite.
#
# Called by:
# - ci.yml (PR checks)
# - release-prepare.yml (tag gate)
#
# Cache strategy: the Linux jobs share one `target/` cache via
# `shared-key: workspace`. The `lint` job seeds it on a cold run; the Linux
# `test`, `features`, and `msrv` jobs then start warm. macOS and Windows keep
# their own caches — a different target triple cannot reuse those artifacts.
#
# Every feature is off by default and each pulls in its own dependency tree, so
# the feature matrix exists to catch the combination that only breaks when a
# feature is *absent* — a `cfg`-gated import, or a struct field that only some
# builds have.
name: Test
on:
workflow_call:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# ─────────────────────────────────────────────────────────────────────────
lint:
name: Lint, Docs & Audit
# Free ARM64 runner for public repos: faster per-core than ubuntu-latest at
# the same (zero) cost. Safe here because this job only compiles — the
# crash/minidump tests that are most architecture-sensitive run in `test`.
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
shared-key: workspace
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build docs
run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
# nextest does not run doctests, and the examples document a crate whose
# misuse fork-bombs the host, so they are kept compiling.
- name: Run doctests
run: cargo test --doc --all-features
- name: Install cargo-deny
uses: taiki-e/install-action@v2
with:
tool: cargo-deny
- name: Dependency audit
run: cargo deny check
# ─────────────────────────────────────────────────────────────────────────
# The suite spawns real child processes: a crash monitor that re-execs the
# helper binary, several processes contending for a file lock, and several
# writing one mmap'd ring. Those behave differently per OS, so all three run
# the full suite rather than compile-checking the non-Linux ones.
#
# `--no-fail-fast` so one regression surfaces every failure in a single run.
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: test-${{ matrix.os }}
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: nextest
# No retries by design — these tests assert counts, so a retry would hide
# a concurrency bug rather than absorb a slow runner. See
# .config/nextest.toml.
- name: Run tests
run: cargo nextest run --all-features --no-fail-fast
# ─────────────────────────────────────────────────────────────────────────
# `wasm32-unknown-unknown` has no clock: `SystemTime::now()` panics there
# rather than returning an error. Since a breadcrumb is recorded on ordinary
# success paths, a regression in that fallback would make merely linking this
# crate into a wasm build fatal — hence a standing check.
wasm:
name: WASM / WASI check (${{ matrix.target }})
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
target:
steps:
- uses: actions/checkout@v7
- name: Install Rust + target
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: wasm-${{ matrix.target }}
# Default features only: `native-crash` and `shared-ring` are host-only.
- name: cargo check --lib
run: cargo check --target ${{ matrix.target }} --lib
# ─────────────────────────────────────────────────────────────────────────
features:
name: Feature matrix (${{ matrix.flags || 'default' }})
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
flags:
- ""
- "--features tracing"
- "--features shared-ring"
- "--features native-crash"
- "--all-features"
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: workspace
- name: cargo check
run: cargo check --lib --bins --tests ${{ matrix.flags }}
# ─────────────────────────────────────────────────────────────────────────
# The declared `rust-version` must actually build. 1.88 is required by this
# crate's own let-chains as well as by the native-crash dependency tree.
msrv:
name: MSRV
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@1.88.0
- uses: Swatinem/rust-cache@v2
with:
shared-key: msrv
- name: cargo check
run: cargo check --all-features --all-targets
# ─────────────────────────────────────────────────────────────────────────
# Catches manifest problems that only surface at publish time: a missing
# README, or an `exclude`d file that something still references.
package:
name: Package
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: workspace
- name: cargo package
run: cargo package --all-features