From b8f6a411d7c3003efa232977c927dd509448c0d8 Mon Sep 17 00:00:00 2001 From: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Date: Mon, 19 Sep 2022 15:50:19 +0200 Subject: [PATCH] [ci] build runtime only if runtime files were changed (#1582) * [WIP][ci] build runtime only if runtime files were changed * debug * enable valid job * enable valid job * enable everything back * test build-runtime-assets-statemine * add need * build nightly * test build runtime statemint * cargo check instead build * rm test file * restart pipeline * add paths to build-runtime-template * add test file to trigger builds * move test * remove test file * trigger pipeline to calculate times * modify build-runtime jobs * add echo * fix semicolon * debug * fix variable * uncomment all * add DAG for build-runtime jobs * restart pipeline --- cumulus/.gitlab-ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 2 deletions(-) diff --git a/cumulus/.gitlab-ci.yml b/cumulus/.gitlab-ci.yml index 4ef5fb8df8..501a71f6ff 100644 --- a/cumulus/.gitlab-ci.yml +++ b/cumulus/.gitlab-ci.yml @@ -234,7 +234,7 @@ build-test-parachain: variables: # Enable debug assertions since we are running optimized builds for testing # but still want to have debug assertions. - RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" + RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings" # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs needs: - job: check-rustdoc @@ -248,9 +248,74 @@ build-test-parachain: - mkdir -p ./artifacts/zombienet - mv ./target/release/wbuild/cumulus-test-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm ./artifacts/zombienet/. +# build runtime only if files in $RUNTIME_PATH/$RUNTIME_NAME were changed +.build-runtime-template: &build-runtime-template + stage: build + <<: *docker-env + <<: *pr-refs + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: check-rustdoc + artifacts: false + variables: + RUNTIME_PATH: "parachains/runtimes/assets" + script: + - cd ${RUNTIME_PATH} + - for directory in $(echo */); do + echo "_____Running cargo check for ${directory} ______"; + cd ${directory}; + pwd; + SKIP_WASM_BUILD=1 cargo check; + cd ..; + done + +# DAG: build-runtime-assets -> build-runtime-collectives -> build-runtime-contracts +# DAG: build-runtime-assets ->build-runtime-starters -> build-runtime-testing +build-runtime-assets: + <<: *build-runtime-template + variables: + RUNTIME_PATH: "parachains/runtimes/assets" + +build-runtime-collectives: + <<: *build-runtime-template + variables: + RUNTIME_PATH: "parachains/runtimes/collectives" + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: build-runtime-assets + artifacts: false + +build-runtime-contracts: + <<: *build-runtime-template + variables: + RUNTIME_PATH: "parachains/runtimes/contracts" + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: build-runtime-collectives + artifacts: false + +build-runtime-starters: + <<: *build-runtime-template + variables: + RUNTIME_PATH: "parachains/runtimes/starters" + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: build-runtime-assets + artifacts: false + +build-runtime-testing: + <<: *build-runtime-template + variables: + RUNTIME_PATH: "parachains/runtimes/testing" + # this is an artificial job dependency, for pipeline optimization using GitLab's DAGs + needs: + - job: build-runtime-starters + artifacts: false + + #### stage: publish -.build-push-image: &build-push-image +.build-push-image: &build-push-image image: quay.io/buildah/stable variables: DOCKERFILE: "" # docker/path-to.Dockerfile