Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 11250a7

Browse files
author
parity-processbot
committed
Merge remote-tracking branch 'origin/master' into kianenigma-patch-1
2 parents 631b64e + f80c370 commit 11250a7

File tree

4 files changed

+98
-34
lines changed

4 files changed

+98
-34
lines changed

.gitlab-ci.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ default:
136136
# exclude cargo-check-benches from such runs
137137
.test-refs-check-benches:
138138
rules:
139-
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "parent_pipeline" && $CI_IMAGE =~ /staging$/
139+
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "parent_pipeline" && $CI_IMAGE =~ /staging$/
140140
when: never
141141
- if: $CI_PIPELINE_SOURCE == "web"
142142
- if: $CI_PIPELINE_SOURCE == "schedule"
@@ -329,10 +329,20 @@ cancel-pipeline-test-linux-stable-int:
329329
needs:
330330
- job: test-linux-stable-int
331331

332-
cancel-pipeline-cargo-check-subkey:
332+
cancel-pipeline-cargo-check-each-crate-1:
333333
extends: .cancel-pipeline-template
334334
needs:
335-
- job: cargo-check-subkey
335+
- job: "cargo-check-each-crate 1/2"
336+
337+
cancel-pipeline-cargo-check-each-crate-2:
338+
extends: .cancel-pipeline-template
339+
needs:
340+
- job: "cargo-check-each-crate 2/2"
341+
342+
cancel-pipeline-cargo-check-each-crate-macos:
343+
extends: .cancel-pipeline-template
344+
needs:
345+
- job: cargo-check-each-crate-macos
336346

337347
cancel-pipeline-check-tracing:
338348
extends: .cancel-pipeline-template
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
## A script that checks each workspace crate individually.
4+
## It's relevant to check workspace crates individually because otherwise their compilation problems
5+
## due to feature misconfigurations won't be caught, as exemplified by
6+
## https://github.com/paritytech/substrate/issues/12705
7+
8+
set -Eeu -o pipefail
9+
shopt -s inherit_errexit
10+
11+
set -x
12+
13+
target_group="$1"
14+
groups_total="$2"
15+
16+
readarray -t workspace_crates < <(\
17+
cargo tree --workspace --depth 0 | \
18+
awk '{ if (length($1) == 0 || substr($1, 1, 1) == "[") { skip } else { print $1 } }'
19+
)
20+
21+
crates_total=${#workspace_crates[*]}
22+
23+
if [ "$crates_total" -lt "$groups_total" ]; then
24+
# `crates_total / groups_total` would result in 0, so round it up to 1
25+
crates_per_group=1
26+
else
27+
# We add `crates_total % groups_total > 0` (which evaluates to 1 in case there's a remainder for
28+
# `crates_total % groups_total`) to round UP `crates_total / groups_total` 's
29+
# potentially-fractional result to the nearest integer. Doing that ensures that we'll not miss any
30+
# crate in case `crates_total / groups_total` would normally result in a fractional number, since
31+
# in those cases Bash would round DOWN the result to the nearest integer. For example, if
32+
# `crates_total = 5` and `groups_total = 2`, then `crates_total / groups_total` would round down
33+
# to 2; since the loop below would then step by 2, we'd miss the 5th crate.
34+
crates_per_group=$(( (crates_total / groups_total) + (crates_total % groups_total > 0) ))
35+
fi
36+
37+
group=1
38+
for ((i=0; i < crates_total; i += crates_per_group)); do
39+
if [ $group -eq "$target_group" ]; then
40+
for crate in "${workspace_crates[@]:$i:$crates_per_group}"; do
41+
cargo check --locked --release -p "$crate"
42+
done
43+
break
44+
fi
45+
group=$(( group + 1 ))
46+
done

scripts/ci/gitlab/pipeline/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ build-linux-substrate:
9090
variables:
9191
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
9292
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
93-
needs:
94-
- job: cargo-check-subkey
95-
artifacts: false
9693
before_script:
9794
- mkdir -p ./artifacts/subkey
9895
- !reference [.rusty-cachier, before_script]

scripts/ci/gitlab/pipeline/test.yml

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -133,24 +133,8 @@ node-bench-regression-guard:
133133
--compare-with artifacts/benches/$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA'
134134
after_script: [""]
135135

136-
cargo-check-subkey:
137-
stage: test
138-
extends:
139-
- .docker-env
140-
- .test-refs
141-
- .pipeline-stopper-artifacts
142-
script:
143-
- rusty-cachier snapshot create
144-
- cd ./bin/utils/subkey
145-
- SKIP_WASM_BUILD=1 time cargo check --locked --release
146-
- rusty-cachier cache upload
147-
148136
cargo-check-try-runtime:
149137
stage: test
150-
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
151-
needs:
152-
- job: cargo-check-subkey
153-
artifacts: false
154138
extends:
155139
- .docker-env
156140
- .test-refs
@@ -393,6 +377,9 @@ test-full-crypto-feature:
393377

394378
test-wasmer-sandbox:
395379
stage: test
380+
needs:
381+
- job: cargo-check-wasmer-sandbox
382+
artifacts: false
396383
extends:
397384
- .docker-env
398385
- .test-refs-wasmer-sandbox
@@ -409,18 +396,6 @@ test-wasmer-sandbox:
409396
- time cargo nextest run --locked --release --features runtime-benchmarks,wasmer-sandbox,disable-ui-tests --partition count:${CI_NODE_INDEX}/${CI_NODE_TOTAL}
410397
- if [ ${CI_NODE_INDEX} == 1 ]; then rusty-cachier cache upload; fi
411398

412-
cargo-check-macos:
413-
stage: test
414-
extends: .test-refs-no-trigger
415-
before_script:
416-
- !reference [.rust-info-script, script]
417-
variables:
418-
SKIP_WASM_BUILD: 1
419-
script:
420-
- time cargo check --locked --release
421-
tags:
422-
- osx
423-
424399
check-rustdoc:
425400
stage: test
426401
variables:
@@ -435,3 +410,39 @@ check-rustdoc:
435410
- rusty-cachier snapshot create
436411
- time cargo +nightly doc --locked --workspace --all-features --verbose --no-deps
437412
- rusty-cachier cache upload
413+
414+
cargo-check-each-crate:
415+
stage: test
416+
extends:
417+
- .docker-env
418+
- .test-refs
419+
- .collect-artifacts
420+
- .pipeline-stopper-artifacts
421+
variables:
422+
# $CI_JOB_NAME is set manually so that rusty-cachier can share the cache for all
423+
# "cargo-check-each-crate I/N" jobs
424+
CI_JOB_NAME: cargo-check-each-crate
425+
script:
426+
- rusty-cachier snapshot create
427+
- time ./scripts/ci/gitlab/check-each-crate.sh "$CI_NODE_INDEX" "$CI_NODE_TOTAL"
428+
# need to update cache only from one job
429+
- if [ "$CI_NODE_INDEX" == 1 ]; then rusty-cachier cache upload; fi
430+
parallel: 2
431+
432+
cargo-check-each-crate-macos:
433+
stage: test
434+
extends:
435+
- .test-refs
436+
- .collect-artifacts
437+
- .pipeline-stopper-artifacts
438+
before_script:
439+
- !reference [.rust-info-script, script]
440+
- !reference [.pipeline-stopper-vars, script]
441+
variables:
442+
SKIP_WASM_BUILD: 1
443+
script:
444+
# TODO: enable rusty-cachier once it supports Mac
445+
# TODO: use parallel jobs, as per cargo-check-each-crate, once more Mac runners are available
446+
- time ./scripts/ci/gitlab/check-each-crate.sh 1 1
447+
tags:
448+
- osx

0 commit comments

Comments
 (0)