-
-
Notifications
You must be signed in to change notification settings - Fork 601
505 lines (446 loc) · 16.3 KB
/
rust.yml
File metadata and controls
505 lines (446 loc) · 16.3 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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
name: Continuous integration
on:
pull_request:
branches:
- main
- releases/**
push:
branches:
- main
- releases/**
merge_group:
types: [checks_requested]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
W_FLAGS: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }}
jobs:
fmt:
name: Formatting
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
components: rustfmt
- name: Format (rustfmt)
run: cargo fmt --all --check
typos:
name: Typos
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Check for typos
uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0
clippy:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
components: clippy
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Clippy (All features)
run: cargo workspaces exec cargo clippy --all-features --all-targets
- name: Clippy (No features)
run: cargo workspaces exec cargo clippy --no-default-features --all-targets
- name: Clippy (Intl)
run: cargo clippy -p boa_engine --features intl
- name: Clippy (Annex-B)
run: cargo clippy -p boa_engine --features annex-b
- name: Clippy (Experimental)
run: cargo clippy -p boa_engine --features experimental
docs:
name: Documentation
runs-on: ubuntu-latest
timeout-minutes: 60
env:
RUSTDOCFLAGS: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && '-D warnings' || '' }}
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Generate documentation
run: cargo doc -v --document-private-items --all-features
msrv:
name: MSRV
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
# Get the rust_version from the Cargo.toml
- name: Get rust_version
id: rust_version
run: echo "rust_version=$(grep '^rust-version' Cargo.toml | cut -d' ' -f3 | tr -d '"')" >> $GITHUB_OUTPUT
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: ${{ steps.rust_version.outputs.rust_version }}
- name: Check compilation
run: cargo check --all-features --all-targets
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 60
if: ${{ github.ref == 'refs/heads/main' || github.base_ref == 'main' }}
needs:
- fmt
- typos
- clippy
- docs
- msrv
steps:
- name: Set environment
# Setting `RUSTFLAGS` overrides any flags set on .cargo/config.toml, so we need to
# set the target flags instead which are cumulative.
# Track https://github.com/rust-lang/cargo/issues/5376
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-tarpaulin
uses: baptiste0928/cargo-install@f204293d9709061b7bc1756fec3ec4e2cd57dec0 # v3.4.0
with:
crate: cargo-tarpaulin
- name: Run tarpaulin
run: cargo tarpaulin --workspace --features annex-b,intl_bundled,experimental --ignore-tests --engine llvm --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
tests:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 60
needs:
- fmt
- typos
- clippy
- docs
- msrv
env:
RUSTUP_WINDOWS_PATH_ADD_BIN: 1
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
- os: windows-latest
- os: ubuntu-24.04-arm
- os: ubuntu-latest
steps:
- name: Set environment
if: ${{ matrix.os != 'windows-latest' }}
# Setting `RUSTFLAGS` overrides any flags set on .cargo/config.toml, so we need to
# set the target flags instead which are cumulative.
# Track https://github.com/rust-lang/cargo/issues/5376
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr '[:lower:]' '[:upper:]' | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Set environment
if: ${{ matrix.os == 'windows-latest' }}
run: |
$target = (rustc -vV | Select-String '^host') -replace '^host:\s+', '' | ForEach-Object { $_.ToUpper().Replace('-', '_') }
"CARGO_TARGET_${target}_RUSTFLAGS=$env:W_FLAGS" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
- name: Install Cargo insta
run: cargo install --locked cargo-insta
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ matrix.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build tests
run: cargo test --no-run --profile ci
# this order is faster according to rust-analyzer
- name: Build
run: cargo build --all-targets --quiet --profile ci --features annex-b,intl_bundled,experimental,embedded_lz4
- name: Install latest nextest
uses: taiki-e/install-action@7cb3ba7bc31801346db00d4a6d7008aabab5e986 # nextest
- name: Test with nextest
run: cargo nextest run --profile ci --cargo-profile ci --features annex-b,intl_bundled,experimental,embedded_lz4
- name: Test docs
run: cargo test --doc --profile ci --features annex-b,intl_bundled,experimental
- name: Test bytecode output
run: cargo insta test -p insta-bytecode
cross-tests:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- fmt
- typos
- clippy
- docs
- msrv
strategy:
matrix:
include:
- target: i686-unknown-linux-gnu
steps:
- name: Set environment
# Setting `RUSTFLAGS` overrides any flags set on .cargo/config.toml, so we need to
# set the target flags instead which are cumulative.
# Track https://github.com/rust-lang/cargo/issues/5376
run: |
target=$(echo ${{ matrix.target }} | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Install Cross
uses: baptiste0928/cargo-install@f204293d9709061b7bc1756fec3ec4e2cd57dec0 # v3.4.0
with:
crate: cross
git: https://github.com/cross-rs/cross
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ matrix.target }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: |
cross test --workspace --target ${{ matrix.target }} \
--profile ci \
--features annex-b,intl_bundled,experimental \
--exclude boa_macros \
--exclude boa_macros_tests
miri:
name: Miri
runs-on: ubuntu-latest
timeout-minutes: 120
needs:
- fmt
- typos
- clippy
- docs
- msrv
steps:
- name: Set environment
# Setting `RUSTFLAGS` overrides any flags set on .cargo/config.toml, so we need to
# set the target flags instead which are cumulative.
# Track https://github.com/rust-lang/cargo/issues/5376
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust nightly with miri
uses: dtolnay/rust-toolchain@0f1b44df7e9cbb178d781a242338dfa5e243ad7f # nightly
with:
components: miri
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-miri-${{ hashFiles('**/Cargo.lock') }}
- name: Setup miri
run: cargo miri setup
- name: Run miri tests
run: cargo miri test --workspace --exclude boa_cli --exclude boa_examples miri
build-fuzz:
name: Fuzzing
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- fmt
- typos
- clippy
- docs
- msrv
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-fuzz
run: cargo install cargo-fuzz
- name: Build fuzz
run: cd tests/fuzz && cargo fuzz build -s none --dev
build-run-examples:
name: Build & run examples
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- fmt
- typos
- clippy
- docs
- msrv
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
with:
toolchain: stable
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
target
~/.cargo/git
~/.cargo/registry
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-workspaces
run: cargo install cargo-workspaces
- name: Build (All features)
run: cargo workspaces exec cargo build --all-features --all-targets --profile ci
- name: Build (No features)
run: cargo workspaces exec cargo build --no-default-features --all-targets --profile ci
- name: Run examples
run: |
cd examples
cargo run -p boa_examples --bin 2>&1 \
| grep -E '^ ' \
| xargs -n1 sh -c 'cargo run -p boa_examples --profile ci --bin $0 || exit 255'
run-semver-check:
name: Check SemVer compatibility
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- fmt
- typos
- clippy
- docs
- msrv
steps:
- name: Set environment
run: |
target=$(rustc -vV | awk '/^host/ { print $2 }' | tr [:lower:] [:upper:] | tr '-' '_')
echo "CARGO_TARGET_${target}_RUSTFLAGS=$W_FLAGS" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Cache cargo
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check Semver
uses: obi1kenobi/cargo-semver-checks-action@5b298c9520f7096a4683c0bd981a7ac5a7e249ae # v2
with:
exclude: boa_wintertc