53
53
- 'runtime/**'
54
54
- 'mock-tee-primitives/**'
55
55
- 'docker/Dockerfile'
56
- - '**/ Cargo.lock'
57
- - '**/ Cargo.toml'
58
- - '**/ rust-toolchain.toml'
56
+ - 'Cargo.lock'
57
+ - 'Cargo.toml'
58
+ - 'rust-toolchain.toml'
59
59
60
60
check-cargo-fmt :
61
61
runs-on : ubuntu-latest
@@ -112,7 +112,7 @@ jobs:
112
112
run : |
113
113
sudo apt-get update && \
114
114
sudo apt-get install -yq openssl clang libclang-dev cmake protobuf-compiler
115
-
115
+
116
116
- name : Run cargo clippy check
117
117
run : make clippy
118
118
@@ -206,6 +206,22 @@ jobs:
206
206
run : |
207
207
make clean-docker-${{ matrix.chain }}
208
208
209
+ # This is used to set github merge rules to protected branch, it's useful for
210
+ # checking the matrix status, where we need to cover
211
+ # - "successful" status (e.g. run-ts-tests(litmus)), and
212
+ # - "skipped" status (run-ts-tests).
213
+ # see https://github.com/orgs/community/discussions/26822
214
+ run-ts-tests-status-check :
215
+ if : ${{ always() }}
216
+ runs-on : ubuntu-latest
217
+ needs : run-ts-tests
218
+ steps :
219
+ - run : |
220
+ case "${{ needs.run-ts-tests.result }}" in
221
+ success|skipped) exit 0 ;;
222
+ *) exit 1 ;;
223
+ esac
224
+
209
225
run-cargo-unit-tests :
210
226
runs-on : ubuntu-latest
211
227
needs : [check-cargo-fmt, check-file-change]
@@ -254,18 +270,11 @@ jobs:
254
270
if : failure()
255
271
256
272
257
-
258
- # The reason why not to put the if-check on the job level is to make sure the
259
- # *matrix* job is run, although it can be skipped in the end.
260
- #
261
- # This is required when setting github merge rules to protected branch,
262
- # where you can only select one of `run-cargo-runtime-tests` and `run-cargo-runtime-tests(litmus)`.
263
- # If you put if-check on the job level, it can't fit every possible case.
264
- #
265
273
# Tried https://github.com/Swatinem/rust-cache too but it didn't work so well
266
274
run-cargo-runtime-tests :
267
275
runs-on : ubuntu-latest
268
276
needs : [check-cargo-fmt, check-file-change]
277
+ if : needs.check-file-change.outputs.src == 'true'
269
278
env :
270
279
RUSTC_WRAPPER : sccache
271
280
SCCACHE_CACHE_SIZE : 10G
@@ -283,7 +292,6 @@ jobs:
283
292
fetch-depth : 0
284
293
285
294
- name : Install toolchain
286
- if : needs.check-file-change.outputs.src == 'true'
287
295
uses : actions-rs/toolchain@v1
288
296
with :
289
297
profile : minimal
@@ -311,9 +319,7 @@ jobs:
311
319
sudo apt-get install -yq openssl clang libclang-dev cmake protobuf-compiler
312
320
313
321
- name : Cache cargo registry
314
- if : needs.check-file-change.outputs.src == 'true'
315
322
uses : actions/cache@v3
316
- continue-on-error : false
317
323
with :
318
324
path : |
319
325
~/.cargo/registry
@@ -324,9 +330,7 @@ jobs:
324
330
cargo-
325
331
326
332
- name : Cache sccache
327
- if : needs.check-file-change.outputs.src == 'true'
328
333
uses : actions/cache@v3
329
- continue-on-error : false
330
334
with :
331
335
path : /home/runner/.cache/sccache
332
336
key : sccache-${{ env.REF_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
@@ -335,17 +339,26 @@ jobs:
335
339
sccache-
336
340
337
341
- name : Run runtime integration tests
338
- if : needs.check-file-change.outputs.src == 'true'
339
342
run : cargo test --locked --release -p ${{ matrix.chain }}-parachain-runtime --lib
340
343
341
344
- name : Print sccache stats
342
- if : needs.check-file-change.outputs.src == 'true'
343
345
run : sccache --show-stats
344
346
345
347
- name : Fail-fast; cancel other jobs
346
348
if : failure()
347
349
348
350
351
+ run-cargo-runtime-tests-status-check :
352
+ if : ${{ always() }}
353
+ runs-on : ubuntu-latest
354
+ needs : run-cargo-runtime-tests
355
+ steps :
356
+ - run : |
357
+ case "${{ needs.run-cargo-runtime-tests.result }}" in
358
+ success|skipped) exit 0 ;;
359
+ *) exit 1 ;;
360
+ esac
361
+
349
362
# Secrets are not passed to the runner when a workflow is triggered from a forked repository,
350
363
# see https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow
351
364
# Only push docker image when tests are passed on dev branch
0 commit comments