-
-
Notifications
You must be signed in to change notification settings - Fork 407
205 lines (193 loc) · 5.73 KB
/
rust.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
name: Continuous integration
on:
pull_request:
branches:
- main
push:
branches:
- main
merge_group:
types: [checks_requested]
env:
RUSTFLAGS: -Dwarnings
jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-tarpaulin
uses: baptiste0928/[email protected]
with:
crate: cargo-tarpaulin
- uses: Swatinem/rust-cache@v2
with:
key: tarpaulin
- name: Run tarpaulin
uses: actions-rs/cargo@v1
with:
command: tarpaulin
args: --workspace --features annex-b,intl,experimental --ignore-tests --engine llvm --out xml
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
tests:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
os:
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
- uses: Swatinem/rust-cache@v2
- 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,experimental
- name: Install latest nextest
uses: taiki-e/install-action@nextest
- name: Test with nextest
run: cargo nextest run --profile ci --cargo-profile ci --features annex-b,intl,experimental
- name: Test docs
run: cargo test --doc --profile ci --features annex-b,intl,experimental
msrv:
name: MSRV
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
# 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
- uses: actions-rs/[email protected]
with:
toolchain: ${{ steps.rust_version.outputs.rust_version }}
override: true
profile: minimal
- name: Check compilation
run: cargo check --all-features --all-targets
fmt:
name: Formatting
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Format (rustfmt)
run: cargo fmt --all --check
clippy:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
components: clippy
- name: Install cargo-workspaces
uses: actions-rs/[email protected]
with:
crate: cargo-workspaces
- uses: Swatinem/rust-cache@v2
with:
key: clippy
- 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: -D warnings
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
key: docs
- name: Generate documentation
run: cargo doc -v --document-private-items --all-features
build-fuzz:
name: Fuzzing
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-fuzz
uses: actions-rs/[email protected]
with:
crate: cargo-fuzz
version: latest
- uses: Swatinem/rust-cache@v2
with:
key: build-fuzz
- name: Build fuzz
run: cargo fuzz build -s none
build-run-examples:
name: Build & run examples
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
profile: minimal
- name: Install cargo-workspaces
uses: actions-rs/[email protected]
with:
crate: cargo-workspaces
- uses: Swatinem/rust-cache@v2
with:
key: build-run-examples
- 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 boa_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'