-
Notifications
You must be signed in to change notification settings - Fork 4
339 lines (311 loc) · 11.8 KB
/
check.yml
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
333
334
335
336
337
338
339
name: Check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
schedule:
- cron: "26 3 * * *" # 03:26 UTC
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
toolchains:
runs-on: ubuntu-latest
outputs:
toolchains: ${{ steps.toolchains.outputs.toolchains }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: Cargo.toml
- id: toolchains
run: |
msrv="$(grep rust-version Cargo.toml | tr -d '"' | cut -f3 -d\ )"
echo "toolchains=[\"$msrv\", \"stable\", \"nightly\"]" >> "$GITHUB_OUTPUT"
check:
needs: toolchains
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust-toolchain: ${{ fromJSON(needs.toolchains.outputs.toolchains) }}
type: [debug]
include:
# Also do some release builds on the latest OS versions.
- os: ubuntu-latest
rust-toolchain: stable
type: release
- os: macos-latest
rust-toolchain: stable
type: release
- os: windows-latest
rust-toolchain: stable
type: release
# Also do some debug builds on the oldest OS versions.
- os: ubuntu-20.04
rust-toolchain: stable
type: debug
- os: macos-12
rust-toolchain: stable
type: debug
- os: windows-2019
rust-toolchain: stable
type: debug
env:
BUILD_TYPE: ${{ matrix.type == 'release' && '--release' || '' }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
version: ${{ matrix.rust-toolchain }}
components: ${{ matrix.rust-toolchain == 'stable' && 'llvm-tools' || '' }} ${{ matrix.rust-toolchain == 'nightly' && 'rust-src' || '' }}
tools: ${{ matrix.rust-toolchain == 'stable' && 'cargo-llvm-cov, ' || '' }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check
run: |
OPTIONS=(--all-targets)
if [ "$BUILD_TYPE" ]; then
OPTIONS+=("$BUILD_TYPE")
fi
cargo +${{ matrix.rust-toolchain }} check "${OPTIONS[@]}"
- name: Run tests and determine coverage
env:
RUST_LOG: trace
run: |
OPTIONS=(--no-fail-fast)
if [ "$BUILD_TYPE" ]; then
OPTIONS+=("$BUILD_TYPE")
fi
if [ "${{ matrix.rust-toolchain }}" == "stable" ] && [ "${{ matrix.type }}" == "debug" ] && [ "${{endsWith(matrix.os, '-latest') && 'latest' || '' }}" == "latest" ]; then
cargo +${{ matrix.rust-toolchain }} llvm-cov test "${OPTIONS[@]}" --lcov --output-path lcov.info
else
if [ "${{ startsWith(matrix.os, 'windows') && 'windows' || '' }}" == "windows" ]; then
# The codegen_windows_bindings test only succeeds when run via llvm-cov?!
OPTIONS+=(-- --skip codegen_windows_bindings)
fi
cargo +${{ matrix.rust-toolchain }} test "${OPTIONS[@]}"
fi
cargo +${{ matrix.rust-toolchain }} bench --no-run
- uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.type == 'debug' && matrix.rust-toolchain == 'stable' && endsWith(matrix.os, '-latest')
- name: Run tests with sanitizers
if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && matrix.rust-toolchain == 'nightly'
env:
RUST_LOG: trace
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
sudo apt-get install -y --no-install-recommends llvm
TARGET="x86_64-unknown-linux-gnu"
SANITIZERS="address thread leak memory"
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
# llvm-symbolizer (as part of llvm) is installed by default on macOS runners
TARGET="aarch64-apple-darwin"
# no memory and leak sanitizer support yet
SANITIZERS="address thread"
# Suppress non-mtu leaks on macOS. TODO: Check occasionally if these are still needed.
{
echo "leak:dyld4::RuntimeState"
echo "leak:fetchInitializingClassList"
} > suppressions.txt
# shellcheck disable=SC2155
export LSAN_OPTIONS="suppressions=$(pwd)/suppressions.txt"
fi
for sanitizer in $SANITIZERS; do
echo "Running tests with $sanitizer sanitizer..."
export RUSTFLAGS="-Z sanitizer=$sanitizer"
export RUSTDOCFLAGS="$RUSTFLAGS"
cargo +nightly test -Z build-std --target "$TARGET"
done
clippy:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
components: clippy
tools: cargo-hack
token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo hack clippy --all-targets --feature-powerset --exclude-features gecko -- -D warnings
- run: cargo doc --workspace --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--deny rustdoc::broken_intra_doc_links --deny warnings"
machete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
tools: cargo-machete
token: ${{ secrets.GITHUB_TOKEN }}
# --with-metadata has false positives, see https://github.com/bnjbvr/cargo-machete/issues/127
- run: cargo machete
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
version: nightly
components: rustfmt
token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo fmt --all -- --check
semver:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
tools: cargo-semver-checks
token: ${{ secrets.GITHUB_TOKEN }}
- run: cargo semver-checks --default-features
readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: mozilla/neqo
sparse-checkout: |
.github/actions/rust
path: neqo
- uses: ./neqo/.github/actions/rust
with:
tools: cargo-readme
token: ${{ secrets.GITHUB_TOKEN }}
- run: |
cargo readme -o /tmp/README.md
diff -u README.md /tmp/README.md
check-vm:
strategy:
fail-fast: false
matrix:
os: [freebsd, openbsd, netbsd] # rust on solaris is too old
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- run: curl -o rustup.sh --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
- if: matrix.os == 'freebsd'
uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4
with:
usesh: true
envs: "CARGO_TERM_COLOR RUST_BACKTRACE GITHUB_ACTIONS"
prepare: |
pkg install -y curl llvm
run: |
sh rustup.sh --default-toolchain stable --component llvm-tools -y
. "$HOME/.cargo/env"
export RUST_LOG=trace
cargo install cargo-llvm-cov --locked
cargo check --all-targets
cargo clippy
cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info
cargo test --no-fail-fast --release
- if: matrix.os == 'openbsd'
uses: vmactions/openbsd-vm@0cfe06e734a0ea3a546fca7ebf200b984b94d58a
with:
usesh: true
envs: "CARGO_TERM_COLOR RUST_BACKTRACE GITHUB_ACTIONS"
prepare: |
pkg_add rust llvm-16.0.6p30 # rustup doesn't support OpenBSD at all
run: |
export LIBCLANG_PATH=/usr/local/llvm16/lib
export RUST_LOG=trace
cargo check --all-targets
cargo clippy
cargo test --no-fail-fast
cargo test --no-fail-fast --release
- if: matrix.os == 'netbsd'
uses: vmactions/netbsd-vm@7c9086fdb4cc1aa814cda6e305390c2b966551a9
with:
usesh: true
envs: "CARGO_TERM_COLOR RUST_BACKTRACE GITHUB_ACTIONS"
prepare: |
/usr/sbin/pkg_add pkgin
pkgin -y install curl clang
run: |
sh rustup.sh --default-toolchain stable --component llvm-tools -y
. "$HOME/.cargo/env"
export LIBCLANG_PATH=/usr/pkg/lib
export RUST_LOG=trace
cargo install cargo-llvm-cov --locked
cargo check --all-targets
cargo clippy
cargo test --no-fail-fast
# FIXME: error[E0463]: can't find crate for `profiler_builtins`,
# so don't fail the workflow when that happens.
cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info || true
cargo test --no-fail-fast --release
- if: matrix.os == 'solaris'
uses: vmactions/solaris-vm@a89b9438868c70db27e41625f0a5de6ff5e90809
with:
usesh: true
envs: "CARGO_TERM_COLOR RUST_BACKTRACE GITHUB_ACTIONS"
run: |
sh rustup.sh --default-toolchain stable --component llvm-tools -y
. "$HOME/.cargo/env"
export RUST_LOG=trace
cargo install cargo-llvm-cov --locked
cargo check --all-targets
cargo clippy
cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info
cargo test --no-fail-fast --release
- uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7
with:
file: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}