1
- name : Linux CI Rust
1
+ name : Rust CI
2
2
3
3
on :
4
4
push :
@@ -16,7 +16,7 @@ concurrency:
16
16
17
17
jobs :
18
18
# Check formatting, clippy warnings, run tests and check code coverage.
19
- build-and-test :
19
+ rust-lints :
20
20
permissions :
21
21
contents : read
22
22
checks : write
51
51
cargo clippy -- -D warnings
52
52
working-directory : rust
53
53
54
- - name : Run tests
55
- run : |
56
- tools/rust-coverage
57
-
58
- - name : Gather and check Rust code coverage
59
- run : |
60
- tools/check-coverage rust/coverage.stats rust/coverage.info
61
-
62
- - name : Run Doc tests
63
- run : |
64
- tools/rust-test doc
65
-
66
54
# Run Rust tests in WASM.
67
55
test-wasm :
68
56
runs-on : ubuntu-24.04
@@ -163,3 +151,113 @@ jobs:
163
151
comment-author : ' github-actions[bot]'
164
152
edit-mode : replace
165
153
body-path : ' report-diff.md'
154
+
155
+ memory-profiler :
156
+ runs-on : ubuntu-24.04
157
+ if : github.event.pull_request.draft == false
158
+ steps :
159
+ - uses : actions/checkout@v4
160
+ with :
161
+ submodules : true
162
+
163
+ - name : Run sccache-cache
164
+ uses :
mozilla-actions/[email protected]
165
+
166
+ - name : Cache Rust
167
+ uses : Swatinem/rust-cache@v2
168
+ with :
169
+ workspaces : |
170
+ rust
171
+
172
+ - name : Install llvm
173
+ run : |
174
+ # to get the symbolizer for debug symbol resolution
175
+ sudo apt install llvm
176
+
177
+ - name : Install nightly
178
+ uses : dtolnay/rust-toolchain@nightly
179
+
180
+ - name : Enable debug symbols
181
+ run : |
182
+ cd rust
183
+ # to fix buggy leak analyzer:
184
+ # https://github.com/japaric/rust-san#unrealiable-leaksanitizer
185
+ # ensure there's a profile.dev section
186
+ if ! grep -qE '^[ \t]*[profile.dev]' Cargo.toml; then
187
+ echo >> Cargo.toml
188
+ echo '[profile.dev]' >> Cargo.toml
189
+ fi
190
+ # remove pre-existing opt-levels in profile.dev
191
+ sed -i '/^\s*\[profile.dev\]/,/^\s*\[/ {/^\s*opt-level/d}' Cargo.toml
192
+ # now set opt-level to 1
193
+ sed -i '/^\s*\[profile.dev\]/a opt-level = 1' Cargo.toml
194
+ cat Cargo.toml
195
+
196
+ - name : cargo test -Zsanitizer=address
197
+ # only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945
198
+ run : |
199
+ cd rust
200
+ cargo test --lib --tests --all-features --target x86_64-unknown-linux-gnu
201
+ env :
202
+ ASAN_OPTIONS : " detect_odr_violation=0:detect_leaks=0"
203
+ RUSTFLAGS : " -Z sanitizer=address"
204
+
205
+ - name : cargo test -Zsanitizer=leak
206
+ if : always()
207
+ run : |
208
+ cd rust
209
+ cargo test --all-features --target x86_64-unknown-linux-gnu
210
+ env :
211
+ RUSTFLAGS : " -Z sanitizer=leak"
212
+
213
+ coverage :
214
+ runs-on : ubuntu-24.04
215
+ if : github.event.pull_request.draft == false
216
+
217
+ steps :
218
+ - uses : actions/checkout@v3
219
+ - name : Install system dependencies
220
+ run : |
221
+ tools/install-sys-dependencies-linux
222
+
223
+ - name : Run sccache-cache
224
+ uses :
mozilla-actions/[email protected]
225
+
226
+ - name : Cache Rust
227
+ uses : Swatinem/rust-cache@v2
228
+ with :
229
+ workspaces : |
230
+ rust
231
+
232
+ - name : Install Rust dependencies
233
+ run : |
234
+ tools/install-rust-dependencies dev
235
+
236
+ - name : cargo generate-lockfile
237
+ if : hashFiles('Cargo.lock') == ''
238
+ run : |
239
+ cd rust
240
+ cargo generate-lockfile
241
+
242
+ - name : Run tests
243
+ run : |
244
+ tools/rust-coverage
245
+
246
+ - name : Run Doc tests
247
+ run : |
248
+ tools/rust-test doc
249
+
250
+ - name : Record Rust version
251
+ run : echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
252
+
253
+ # TODO: Uncomment this when we have a codecov token
254
+ # - name: Upload to codecov.io
255
+ # uses: codecov/codecov-action@v5
256
+ # with:
257
+ # fail_ci_if_error: true
258
+ # token: ${{ secrets.CODECOV_TOKEN }}
259
+ # env_vars: OS,RUST
260
+
261
+ - name : Gather and check Rust code coverage
262
+ run : |
263
+ tools/check-coverage rust/coverage.stats rust/lcov.info
0 commit comments