-
Notifications
You must be signed in to change notification settings - Fork 8
332 lines (316 loc) · 10.9 KB
/
Copy pathci.yml
File metadata and controls
332 lines (316 loc) · 10.9 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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D rustdoc::broken-intra-doc-links
RUSTUP_MAX_RETRIES: 10
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# rustfmt.toml uses `imports_granularity` and `group_imports`, both
# nightly-only options — fmt has to run on nightly.
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: clippy (${{ matrix.label }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: default
features: ""
- label: tokio-rich
features: --features "tls,http2,http3,plugins,signals,multipart,simd,protobuf,ip-filter,hmac-signature,json-schema,zstd,client,validator,garde,typed-header,zero-copy-extractors,async-graphql,grpc,utoipa,vespera,metrics-prometheus,metrics-opentelemetry,tako-tracing,jwt-simple,file-stream,jemalloc,ahash,graphiql"
- label: all-features
features: --all-features
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: clippy-${{ matrix.label }}
# `--tests --examples` extends the lint sweep to the integration test
# crate (`tako-rs/tests/*.rs`) and every example. Workspace-level
# `pedantic = warn` opts those in too, so `-D warnings` catches
# regressions like the ones surfaced by the v2 release audit (items
# after statements, ignored unit patterns, map_unwrap_or).
- run: cargo clippy --workspace --no-deps --tests --examples ${{ matrix.features }} -- -D warnings
test:
name: test (${{ matrix.os }} / ${{ matrix.toolchain }} / ${{ matrix.label }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain: [stable]
label: [default]
features: [""]
include:
- os: ubuntu-latest
toolchain: stable
label: rich
features: --features "tls,http2,plugins,signals,multipart,simd,protobuf,ip-filter,hmac-signature,json-schema,zstd,client,typed-header,zero-copy-extractors,jwt-simple,file-stream"
- os: ubuntu-latest
toolchain: stable
label: http3
features: --features "tls,http2,http3,plugins,signals"
- os: ubuntu-latest
toolchain: stable
label: all-features
# Regression guard for A1 (compio/tokio !Send mismatch under
# workspace-wide --all-features test-build). Re-fixing the
# gated test bins requires both runtimes resolved at once.
features: --all-features
# Beta toolchain — early-warning for nightly→stable regressions
# picked up by upstream crates.
- os: ubuntu-latest
toolchain: beta
label: default
features: ""
# MSRV pin — make sure the declared `rust-version = "1.95"` actually
# builds AND passes tests. The plain `msrv` job below only builds;
# this one runs the rich feature set under the floor toolchain.
- os: ubuntu-latest
toolchain: "1.95"
label: msrv-rich
features: --features "tls,http2,plugins,signals,multipart,simd,protobuf,jwt-simple,client,typed-header,zero-copy-extractors,file-stream"
env:
# Tests don't need to break on every clippy nit; only enforce build-warnings
# in build/clippy/doc jobs.
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.os }}-${{ matrix.toolchain }}-${{ matrix.label }}
- run: cargo test --workspace ${{ matrix.features }}
msrv:
name: MSRV build (1.95)
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.95"
- uses: Swatinem/rust-cache@v2
with:
key: msrv-1.95
# Plain `cargo build` on the declared MSRV — paired with the
# `toolchain: 1.95` row of the test matrix above so we catch both
# compilation errors and behaviour drift at the floor toolchain.
- run: cargo build --workspace --all-features
doc:
name: rustdoc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: doc
# `--all-features` catches broken intra-doc links that only appear on
# feature-gated modules (timeout middleware, webtransport, compio
# adapters). `RUSTDOCFLAGS: -D rustdoc::broken-intra-doc-links` from the
# workflow `env` then turns those into hard failures.
- run: cargo doc --no-deps --workspace --all-features
deny:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
examples:
name: examples build
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: examples
- name: Build every example
run: |
set -euo pipefail
# `examples/*` are excluded from the workspace, so iterate manifest by
# manifest. Failures in any single example fail the job.
for manifest in examples/*/Cargo.toml; do
echo "::group::Building ${manifest}"
cargo build --release --manifest-path "${manifest}"
echo "::endgroup::"
done
bench-build:
name: bench compile check
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: bench
# Verify the criterion harnesses still compile. We do not run them in
# CI by default — bench numbers are PR-noise. A scheduled job runs the
# full suite and posts the comparison.
- run: cargo bench --no-run -p tako-rs-core
autobahn:
name: autobahn websocket suite
runs-on: ubuntu-latest
# The suite is heavy (4-7 minutes) and depends on docker. Run it on
# PRs that touch streams + on main. PRs that don't touch the WS path
# opt out via path filter.
if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' &&
contains(github.event.pull_request.labels.*.name, 'run-autobahn'))
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: autobahn
- name: Run Autobahn fuzzingclient
run: ci/autobahn/run.sh
- uses: actions/upload-artifact@v4
if: always()
with:
name: autobahn-report
path: ci/autobahn/reports/
fuzz-build:
name: fuzz harness compile check
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
key: fuzz-build
# cargo-fuzz needs the host nightly target with libfuzzer; we only
# check that the targets compile here. Actual fuzz runs are
# scheduled separately and post their findings to the issue tracker.
- run: cargo install cargo-fuzz --version "^0.13"
- run: cargo +nightly fuzz build
fuzz-smoke:
name: fuzz smoke (60s per target)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-fuzz')
env:
RUSTFLAGS: ""
strategy:
fail-fast: false
matrix:
target:
- proxy_protocol_parser
- path_params_deserializer
- grpc_timeout_parser
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
with:
key: fuzz-${{ matrix.target }}
- run: cargo install cargo-fuzz --version "^0.13"
- name: smoke
run: |
cargo +nightly fuzz run ${{ matrix.target }} \
-- -max_total_time=60
miri:
name: miri (tako-rs-core + tako-rs-extractors)
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
MIRIFLAGS: -Zmiri-strict-provenance -Zmiri-disable-isolation
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri
- uses: Swatinem/rust-cache@v2
with:
key: miri
# Miri can't see most async I/O — keep the run scoped to the pure-Rust
# subset that fits its execution model. The body extractor / params
# deserializer / problem responder / signals registry suite is the
# critical-correctness slice we want UB-checked.
- run: |
cargo +nightly miri test \
-p tako-rs-core \
-p tako-rs-extractors \
--no-default-features \
--features simd \
-- \
--skip server_ \
--skip tcp_ \
--skip udp_ \
--skip h3_ \
--skip tls_
docs:
name: docs site build
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install
working-directory: website
run: bun install --frozen-lockfile
- name: Audit (frontmatter, meta.json coverage, internal links)
working-directory: website
run: bun run audit
- name: Build
working-directory: website
run: bun run build
coverage:
name: coverage
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
key: coverage
- uses: taiki-e/install-action@cargo-llvm-cov
- name: collect coverage
run: |
cargo llvm-cov --workspace \
--features "tls,http2,plugins,signals,multipart,simd,protobuf,jwt-simple,client,typed-header" \
--lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false