-
Notifications
You must be signed in to change notification settings - Fork 8
286 lines (270 loc) · 8.72 KB
/
ci.yml
File metadata and controls
286 lines (270 loc) · 8.72 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
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 }}
- run: cargo clippy --workspace --no-deps ${{ matrix.features }} -- -D warnings
test:
name: test (${{ matrix.os }} / ${{ matrix.label }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
label: [default]
features: [""]
include:
- os: ubuntu-latest
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
label: http3
features: --features "tls,http2,http3,plugins,signals"
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@stable
- uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.os }}-${{ matrix.label }}
- run: cargo test --workspace ${{ matrix.features }}
msrv:
name: MSRV (latest stable)
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: msrv-stable
- run: cargo build --workspace
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
- run: cargo doc --no-deps --workspace --features "tls,http2,http3,plugins,signals,multipart,simd,client,typed-header,zero-copy-extractors,utoipa,async-graphql,grpc"
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-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 --manifest-path fuzz/Cargo.toml
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 }} \
--manifest-path fuzz/Cargo.toml \
-- -max_total_time=60
miri:
name: miri (tako-core + tako-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-core \
-p tako-extractors \
--no-default-features \
--features simd \
-- \
--skip server_ \
--skip tcp_ \
--skip udp_ \
--skip h3_ \
--skip tls_
mdbook:
name: mdbook build
runs-on: ubuntu-latest
env:
RUSTFLAGS: ""
steps:
- uses: actions/checkout@v4
- uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: "latest"
- run: mdbook build book
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