-
Notifications
You must be signed in to change notification settings - Fork 66
383 lines (368 loc) · 13.3 KB
/
ci.yml
File metadata and controls
383 lines (368 loc) · 13.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
name: CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- main
- next
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
pull_request:
paths-ignore:
- "**.md"
- "**.txt"
- "docs/**"
env:
# Set the new value when the cache grows too much and we hit the runner's disk space limit
# via https://github.com/rust-lang/docs.rs/pull/2433
RUST_CACHE_KEY: rust-cache-20251212
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Use a common cache for the basic compilation/formatter/clippy checks
shared-key: ${{ github.workflow }}-shared
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Clippy
run: |
cargo make clippy
check_format:
name: check formatting
runs-on: ubuntu-latest
# Run this job after the linter, so the cache is hot
needs: [lint]
# But run this check even if the lint check failed
if: ${{ always() }}
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Use a common cache for the basic compilation/formatter/clippy checks
shared-key: ${{ github.workflow }}-shared
prefix-key: ${{ env.RUST_CACHE_KEY }}
# But do not save this cache, just use it
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Check Formatting
run: |
cargo make check-format
unit_tests:
name: midenc unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
# also share the cache for the tests for efficiency
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Check
# We run `cargo check` to verify that the workspace compiles correctly before attempting
# to execute the tests from each crate. This produces easier to read output if a compilation
# error occurs
run: |
cargo make check --tests
- name: Test
run: |
cargo make test -E 'not (package(miden-integration-tests) or package(midenc-integration-network-tests) or package(cargo-miden))'
lit_tests:
name: midenc lit/filecheck tests
runs-on: ubuntu-latest
# We only want to run our lit tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# NOTE: We use a different cache for the tests, so they can be run in parallel, but we
# also share the cache for the tests for efficiency
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test-lit
midenc_integration_tests:
name: midenc integration tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
# Skip some tests cause they are a space hog and run them in the separate job
run: |
cargo make test -E 'package(miden-integration-tests) - test(~rust_masm_tests::examples)'
midenc_integration_tests_examples:
name: midenc integration tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
# Skip some tests cause they are a space hog and run them in the separate job
run: |
cargo make test -E 'test(~rust_masm_tests::examples)'
cargo_miden_integration_tests:
name: cargo-miden integration tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
# Skip running the some test since they are a disc space hog.
run: |
cargo make test -E 'package(cargo-miden) - test(new_project_integration_tests_pass) - test(test_all_templates_and_examples)'
cargo_miden_tests_mpt:
name: cargo-miden test Miden project template
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test -E 'test(new_project_integration_tests_pass)'
cargo_miden_tests_templates_and_examples:
name: cargo-miden test new project templates and examples
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test -E 'test(test_all_templates)'
miden_integration_node_tests:
name: miden integration node tests
runs-on: ubuntu-latest
# We only want to run the integration tests if the unit tests pass, and that has the added
# benefit that we can re-use the cache from the unit test job for all integration tests
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ github.workflow }}-shared-tests
prefix-key: ${{ env.RUST_CACHE_KEY }}
# Do not persist the cache, leave that to the unit tests, we just use the cache here
save-if: false
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Test
run: |
cargo make test -E 'package(midenc-integration-network-tests)'
check_release:
name: release checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# NOTE: We use a different cache for the these release checks
shared-key: ${{ github.workflow }}-shared-release-checks
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: Check(release)
# We run `check` with `--release` to check the release build (without
# `debug_assertions`, etc.)
run: |
cargo make check --release --tests
- name: Check each member (release)
# To uncover any compilation errors hidden by the workspace feature
# unification and avoid surprises on publishing the crates.
run: |
cargo make check-each --release --all-features
cargo_publish_dry_run:
name: cargo publish dry run
runs-on: ubuntu-latest
needs: [unit_tests]
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cleanup-runner
- name: Install Rust
run: |
rustup update --no-self-update
rustc --version
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Use a common cache for the basic compilation/formatter/clippy checks
shared-key: ${{ github.workflow }}-shared
prefix-key: ${{ env.RUST_CACHE_KEY }}
save-if: ${{ github.ref == 'refs/heads/next' }}
- name: Install cargo-make
run: |
if ! cargo make --version 2>/dev/null; then
cargo install cargo-make --force
fi
- name: cargo publish dry run
# Simulate publishing to uncover any build errors when each crate folder is built in isolation
run: |
cargo make publish-dry-run