-
-
Notifications
You must be signed in to change notification settings - Fork 22
257 lines (212 loc) · 7.16 KB
/
ci.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
name: ci
on:
workflow_dispatch:
merge_group:
pull_request:
push:
branches:
- master
- hotfix/*
defaults:
run:
shell: bash
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: --deny warnings
RUSTFLAGS: --deny warnings
# This disables incremental compilation for workspace packages and path deps.
# All other dependencies including registry deps will still use the incremental cache.
CARGO_INCREMENTAL: 0
jobs:
# Sanity-check that benchmarks work
runtime-benchmarks:
runs-on: ubuntu-latest
strategy:
matrix:
benchmark:
- args_3
- args_5
- args_10_alloc
- args_10_structs
- args_10
- args_20
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: sudo apt-get install -y valgrind
- run: cd ./benchmarks/runtime && ./run.sh ${{ matrix.benchmark }}
compilation-benchmarks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: ./scripts/install/hyperfine.sh
- run: cd ./benchmarks/compilation && ./run.sh
version-sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./scripts/sync-version.sh
env:
# Use `cargo` pre-installed in the Github Managed runner image
RUSTUP_TOOLCHAIN: stable
- run: >-
git diff --exit-code --color=always || ( echo "Version is not
synchronized in other files. See diff above" && exit 1 )
cargo-lock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# There is a pre-installed cargo in the Github Managed runner image
# which is totally fine for simple `cargo fetch` usage.
- run: cargo +stable fetch
# Manually validate that Cargo.lock is not changed by cargo fetch
# We do this manually because `cargo fetch --locked` doesn't show
# the diff that it wants to apply to Cargo.lock and so it may not
# be obvious what's going on. For example, there may be a tricky
# scenario when `Cargo.lock` is up-to-date on the current branch,
# but when rebased on `master` it is out-of-date because.
- name: Validate Cargo.lock is up-to-date
run: >-
git diff --exit-code --color=always || ( echo "Cargo.lock is
out-of-date. See the diff above. Try rebasing on master" && exit 1 )
test-stable:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# rust-src is required to make sure compile errors on CI are rendered
# the same as locally. The `rust-src` component is installed by default
# locally, and with its presence compile error messages can show snippets
# of rust standard library code.
components: rust-src
- run: cargo clippy --all-features --all-targets --locked
- run: cargo test --locked --all-features --all-targets
- run: cargo test --locked --all-features --doc
- run: |
cd bon && cargo test --locked --no-default-features \
--features=experimental-overwritable,experimental-getter
- run: |
cd bon && cargo test --locked --no-default-features \
--features=experimental-overwritable,experimental-getter,alloc
- run: |
cd bon && cargo test --locked --no-default-features \
--features=experimental-overwritable,experimental-getter,implied-bounds
- run: |
cd bon && cargo test --locked --no-default-features \
--features=experimental-overwritable,experimental-getter,alloc,implied-bounds
test-msrv:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
toolchain: 1.59.0
- run: ./scripts/test-msrv.sh
test-unstable:
runs-on: ubuntu-latest
# This job is optional to pass. It notifies us about the potential breakages
# in the future Rust toolchain versions.
continue-on-error: true
strategy:
fail-fast: false
matrix:
toolchain: [beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- run: |
cargo +${{ matrix.toolchain }} clippy --all-features --all-targets --locked \
-- \
--allow edition-2024-expr-fragment-specifier \
--allow if_let_rescope \
--allow impl-trait-overcaptures
cargo-miri:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly-2024-10-30
components: miri, rust-src
- run: |
cargo miri test --locked --all-features --all-targets \
--workspace --exclude runtime-benchmarks
env:
RUSTFLAGS: >-
--deny warnings
--allow edition-2024-expr-fragment-specifier
--allow if_let_rescope
--allow impl-trait-overcaptures
cargo-doc:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo doc --no-deps
cargo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo fmt --check
# Check for unused dependencies that uses simple regex search,
# meaning it's ⚡️ blazingly ⚡️ fast
cargo-machete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/install/cargo-machete.sh
- run: cargo-machete
# Check the formatting of TOML files in the repository
taplo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: scripts/install/taplo.sh
- run: taplo fmt --check
# Check the formatting of Markdown, TS, JS, JSON, YAML files in the repository
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx prettier --check .
# Check for typos in the repository based on a static dictionary
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
website-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Needed for "lastUpdated" property in VitePress
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: website/package-lock.json
- run: cd website && npm ci
- run: scripts/validate-links.sh