1- # .gitlab-ci.yml
1+ # polkadot-sdk | CI definitions (via GitLab CI)
22#
3- # substrate
3+ # FYI: Pipelines can be triggered manually through the web UI (if you have enough permissions)
44#
5- # pipelines can be triggered manually in the web
6- #
7- # Currently the file is divided into subfiles. Each stage has a different file which
8- # can be found here: gitlab/pipeline/<stage_name>.yml
9- #
10- # Instead of YAML anchors "extends" is used.
11- # Useful links:
12- # https://docs.gitlab.com/ee/ci/yaml/index.html#extends
13- # https://docs.gitlab.com/ee/ci/yaml/yaml_optimization.html#reference-tags
14- #
15- # SAMPLE JOB TEMPLATE - This is not a complete example but is enough to build a
16- # simple CI job. For full documentation, visit https://docs.gitlab.com/ee/ci/yaml/
17- #
18- # my-example-job:
19- # stage: test # One of the stages listed below this job (required)
20- # image: paritytech/tools:latest # Any docker image (required)
21- # allow_failure: true # Allow the pipeline to continue if this job fails (default: false)
22- # needs:
23- # - job: test-linux # Any jobs that are required to run before this job (optional)
24- # variables:
25- # MY_ENVIRONMENT_VARIABLE: "some useful value" # Environment variables passed to the job (optional)
26- # script:
27- # - echo "List of shell commands to run in your job"
28- # - echo "You can also just specify a script here, like so:"
29- # - ./gitlab/my_amazing_script.sh
5+ # Currently, entire CI instructions are split into different subfiles. Each CI stage has a corresponding
6+ # file which can be found here: .gitlab/pipeline/<stage_name>.yml
307
318stages :
329 - check
@@ -84,23 +61,26 @@ default:
8461
8562.prepare-env :
8663 before_script :
87- # TODO: remove unset invocation when we'll be free from 'ENV RUSTC_WRAPPER=sccache' & sccache
88- # itself in all images
89- - unset RUSTC_WRAPPER
9064 # $WASM_BUILD_WORKSPACE_HINT enables wasm-builder to find the Cargo.lock from within generated
9165 # packages
9266 - export WASM_BUILD_WORKSPACE_HINT="$PWD"
9367 # ensure that RUSTFLAGS are set correctly
9468 - echo $RUSTFLAGS
9569
70+ .common-before-script :
71+ before_script :
72+ - !reference [.job-switcher, before_script]
73+ - !reference [.timestamp, before_script]
74+ - !reference [.pipeline-stopper-vars, script]
75+
9676.job-switcher :
9777 before_script :
9878 - if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi
9979
10080.kubernetes-env :
10181 image : " ${CI_IMAGE}"
10282 before_script :
103- # - !reference [.job-switcher , before_script]
83+ - !reference [.common-before-script , before_script]
10484 - !reference [.prepare-env, before_script]
10585 tags :
10686 - kubernetes-parity-build
@@ -112,9 +92,10 @@ default:
11292 - rustup +nightly show
11393 - cargo +nightly --version
11494
95+ # collecting vars for pipeline stopper
96+ # they will be used if the job fails
11597.pipeline-stopper-vars :
11698 script :
117- - !reference [.job-switcher, before_script]
11899 - echo "Collecting env variables for the cancel-pipeline job"
119100 - echo "FAILED_JOB_URL=${CI_JOB_URL}" > pipeline-stopper.env
120101 - echo "FAILED_JOB_NAME=${CI_JOB_NAME}" >> pipeline-stopper.env
@@ -128,28 +109,26 @@ default:
128109.docker-env :
129110 image : " ${CI_IMAGE}"
130111 before_script :
131- - !reference [.job-switcher , before_script]
112+ - !reference [.common-before-script , before_script]
132113 - !reference [.prepare-env, before_script]
133114 - !reference [.rust-info-script, script]
134115 - !reference [.rusty-cachier, before_script]
135- - !reference [.pipeline-stopper-vars, script]
136- after_script :
137- - !reference [.rusty-cachier, after_script]
138116 tags :
139117 - linux-docker-vm-c2
140118
141119# rusty-cachier's hidden job. Parts of this job are used to instrument the pipeline's other real jobs with rusty-cachier
142- # Description of the commands is available here - https://gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client#description
120+ # rusty-cachier's commands are described here: https://gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client#description
143121.rusty-cachier :
144122 before_script :
145123 # - curl -s https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.parity.io/parity/infrastructure/ci_cd/rusty-cachier/client/-/raw/release/util/install.sh | bash
146- # - rusty-cachier environment check --gracefully
147- # - $(rusty-cachier environment inject)
148- # - rusty-cachier project mtime
124+ # - mkdir -p cargo_home cargo_target_dir
125+ # - export CARGO_HOME=$CI_PROJECT_DIR/cargo_home
126+ # - export CARGO_TARGET_DIR=$CI_PROJECT_DIR/cargo_target_dir
127+ # - find . \( -path ./cargo_target_dir -o -path ./cargo_home \) -prune -o -type f -exec touch -t 202005260100 {} +
128+ # - git restore-mtime
129+ # - rusty-cachier --version
130+ # - rusty-cachier project touch-changed
149131 - echo tbd
150- after_script :
151- - echo tbd
152- # - env RUSTY_CACHIER_SUPRESS_OUTPUT=true rusty-cachier snapshot destroy
153132
154133.common-refs :
155134 rules :
@@ -233,6 +212,125 @@ include:
233212 # zombienet jobs
234213 - .gitlab/pipeline/zombienet.yml
235214 # # timestamp handler
236- # - project: parity/infrastructure/ci_cd/shared
237- # ref: v0.2
238- # file: /common/timestamp.yml
215+ - project : parity/infrastructure/ci_cd/shared
216+ ref : v0.2
217+ file : /common/timestamp.yml
218+
219+ # This job cancels the whole pipeline if any of provided jobs fail.
220+ # In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
221+ # to fail the pipeline as soon as possible to shorten the feedback loop.
222+ .cancel-pipeline-template :
223+ stage : .post
224+ rules :
225+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
226+ when : on_failure
227+ variables :
228+ PROJECT_ID : " ${CI_PROJECT_ID}"
229+ PROJECT_NAME : " ${CI_PROJECT_NAME}"
230+ PIPELINE_ID : " ${CI_PIPELINE_ID}"
231+ FAILED_JOB_URL : " ${FAILED_JOB_URL}"
232+ FAILED_JOB_NAME : " ${FAILED_JOB_NAME}"
233+ PR_NUM : " ${PR_NUM}"
234+ trigger :
235+ project : " parity/infrastructure/ci_cd/pipeline-stopper"
236+ branch : " as-improve"
237+
238+ remove-cancel-pipeline-message :
239+ stage : .post
240+ rules :
241+ - if : $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
242+ variables :
243+ PROJECT_ID : " ${CI_PROJECT_ID}"
244+ PROJECT_NAME : " ${CI_PROJECT_NAME}"
245+ PIPELINE_ID : " ${CI_PIPELINE_ID}"
246+ FAILED_JOB_URL : " https://gitlab.com"
247+ FAILED_JOB_NAME : " nope"
248+ PR_NUM : " ${CI_COMMIT_REF_NAME}"
249+ trigger :
250+ project : " parity/infrastructure/ci_cd/pipeline-stopper"
251+ # need to copy jobs this way because otherwise gitlab will wait
252+ # for all 3 jobs to finish instead of cancelling if one fails
253+ cancel-pipeline-test-linux-stable1 :
254+ extends : .cancel-pipeline-template
255+ needs :
256+ - job : " test-linux-stable 1/3"
257+
258+ cancel-pipeline-test-linux-stable2 :
259+ extends : .cancel-pipeline-template
260+ needs :
261+ - job : " test-linux-stable 2/3"
262+
263+ cancel-pipeline-test-linux-stable3 :
264+ extends : .cancel-pipeline-template
265+ needs :
266+ - job : " test-linux-stable 3/3"
267+
268+ cancel-pipeline-test-linux-stable-additional-tests :
269+ extends : .cancel-pipeline-template
270+ needs :
271+ - job : " test-linux-stable-additional-tests"
272+
273+ cancel-pipeline-test-linux-stable-slow :
274+ extends : .cancel-pipeline-template
275+ needs :
276+ - job : " test-linux-stable-slow"
277+
278+ cancel-pipeline-cargo-check-benches1 :
279+ extends : .cancel-pipeline-template
280+ needs :
281+ - job : " cargo-check-benches 1/2"
282+
283+ cancel-pipeline-cargo-check-benches2 :
284+ extends : .cancel-pipeline-template
285+ needs :
286+ - job : " cargo-check-benches 2/2"
287+
288+ cancel-pipeline-test-linux-stable-int :
289+ extends : .cancel-pipeline-template
290+ needs :
291+ - job : test-linux-stable-int
292+
293+ cancel-pipeline-cargo-check-each-crate-1 :
294+ extends : .cancel-pipeline-template
295+ needs :
296+ - job : " cargo-check-each-crate 1/6"
297+
298+ cancel-pipeline-cargo-check-each-crate-2 :
299+ extends : .cancel-pipeline-template
300+ needs :
301+ - job : " cargo-check-each-crate 2/6"
302+
303+ cancel-pipeline-cargo-check-each-crate-3 :
304+ extends : .cancel-pipeline-template
305+ needs :
306+ - job : " cargo-check-each-crate 3/6"
307+
308+ cancel-pipeline-cargo-check-each-crate-4 :
309+ extends : .cancel-pipeline-template
310+ needs :
311+ - job : " cargo-check-each-crate 4/6"
312+
313+ cancel-pipeline-cargo-check-each-crate-5 :
314+ extends : .cancel-pipeline-template
315+ needs :
316+ - job : " cargo-check-each-crate 5/6"
317+
318+ cancel-pipeline-cargo-check-each-crate-6 :
319+ extends : .cancel-pipeline-template
320+ needs :
321+ - job : " cargo-check-each-crate 6/6"
322+
323+ cancel-pipeline-cargo-check-each-crate-macos :
324+ extends : .cancel-pipeline-template
325+ needs :
326+ - job : cargo-check-each-crate-macos
327+
328+ cancel-pipeline-check-tracing :
329+ extends : .cancel-pipeline-template
330+ needs :
331+ - job : check-tracing
332+
333+ cancel-pipeline-cargo-clippy :
334+ extends : .cancel-pipeline-template
335+ needs :
336+ - job : cargo-clippy
0 commit comments