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

Commit

Permalink
Automatically format ci pipeline specs with prettier (#2229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mira Ressel authored Feb 27, 2023
1 parent 0ce339b commit 590387a
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 187 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.gitlab-ci.yml filter=ci-prettier
/scripts/ci/gitlab/pipeline/*.yml filter=ci-prettier
87 changes: 43 additions & 44 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#
# pipelines can be triggered manually in the web


stages:
- test
- build
Expand All @@ -15,7 +14,7 @@ stages:
- zombienet

default:
interruptible: true
interruptible: true
retry:
max: 2
when:
Expand All @@ -24,19 +23,19 @@ default:
- api_failure

variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CARGO_INCREMENTAL: 0
CI_IMAGE: "paritytech/ci-linux:production"
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.35"
GIT_STRATEGY: fetch
GIT_DEPTH: 100
CARGO_INCREMENTAL: 0
CI_IMAGE: "paritytech/ci-linux:production"
DOCKER_OS: "debian:stretch"
ARCH: "x86_64"
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.35"

.collect-artifacts:
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: on_success
expire_in: 1 days
paths:
- ./artifacts/

Expand All @@ -52,40 +51,40 @@ variables:

.pipeline-stopper-artifacts:
artifacts:
reports:
dotenv: pipeline-stopper.env
reports:
dotenv: pipeline-stopper.env

.common-refs:
# these jobs run always*
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
- if: $CI_COMMIT_REF_NAME =~ /^polkadot-v[0-9]+\.[0-9]+.*$/ # i.e. polkadot-v1.0.99, polkadot-v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
- if: $CI_COMMIT_REF_NAME =~ /^polkadot-v[0-9]+\.[0-9]+.*$/ # i.e. polkadot-v1.0.99, polkadot-v2.1rc1

.pr-refs:
# these jobs run always*
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs

.publish-refs:
rules:
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

# run benchmarks manually only on release-parachains-v* branch
.benchmarks-manual-refs:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
when: manual

# run benchmarks only on release-parachains-v* branch
.benchmarks-refs:
rules:
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000
- if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9].*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1, release-parachains-v3000

.zombienet-refs:
rules:
Expand All @@ -94,14 +93,14 @@ variables:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: never
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs

.job-switcher:
before_script:
- if echo "$CI_DISABLED_JOBS" | grep -xF "$CI_JOB_NAME"; then echo "The job has been cancelled in CI settings"; exit 0; fi

.docker-env:
image: "${CI_IMAGE}"
image: "${CI_IMAGE}"
before_script:
- !reference [.job-switcher, before_script]
- rustup show
Expand All @@ -113,7 +112,7 @@ variables:
- linux-docker-vm-c2

.kubernetes-env:
image: "${CI_IMAGE}"
image: "${CI_IMAGE}"
before_script:
- !reference [.job-switcher, before_script]
tags:
Expand Down Expand Up @@ -152,33 +151,33 @@ include:
# In a DAG, every jobs chain is executed independently of others. The `fail_fast` principle suggests
# to fail the pipeline as soon as possible to shorten the feedback loop.
cancel-pipeline:
stage: .post
stage: .post
needs:
- job: test-linux-stable
- job: test-linux-stable
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
when: on_failure
variables:
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
FAILED_JOB_URL: "${FAILED_JOB_URL}"
FAILED_JOB_NAME: "${FAILED_JOB_NAME}"
PR_NUM: "${PR_NUM}"
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
FAILED_JOB_URL: "${FAILED_JOB_URL}"
FAILED_JOB_NAME: "${FAILED_JOB_NAME}"
PR_NUM: "${PR_NUM}"
trigger:
project: "parity/infrastructure/ci_cd/pipeline-stopper"
branch: "as-improve"
project: "parity/infrastructure/ci_cd/pipeline-stopper"
branch: "as-improve"

remove-cancel-pipeline-message:
stage: .post
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
variables:
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
FAILED_JOB_URL: "https://gitlab.com"
FAILED_JOB_NAME: "nope"
PR_NUM: "${CI_COMMIT_REF_NAME}"
PROJECT_ID: "${CI_PROJECT_ID}"
PROJECT_NAME: "${CI_PROJECT_NAME}"
PIPELINE_ID: "${CI_PIPELINE_ID}"
FAILED_JOB_URL: "https://gitlab.com"
FAILED_JOB_NAME: "nope"
PR_NUM: "${CI_COMMIT_REF_NAME}"
trigger:
project: "parity/infrastructure/ci_cd/pipeline-stopper"
project: "parity/infrastructure/ci_cd/pipeline-stopper"
14 changes: 7 additions & 7 deletions scripts/ci/gitlab/pipeline/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Work only on release-parachains-v* branches

benchmarks-build:
stage: benchmarks-build
stage: benchmarks-build
extends:
- .docker-env
- .collect-artifacts
Expand All @@ -14,8 +14,8 @@ benchmarks-build:
- cp target/production/polkadot-parachain ./artifacts/

benchmarks-assets:
stage: benchmarks-run
timeout: 1d
stage: benchmarks-run
timeout: 1d
extends:
- .collect-artifacts
- .benchmarks-refs
Expand All @@ -37,8 +37,8 @@ benchmarks-assets:
- weights

benchmarks-collectives:
stage: benchmarks-run
timeout: 1d
stage: benchmarks-run
timeout: 1d
extends:
- .collect-artifacts
- .benchmarks-refs
Expand All @@ -58,8 +58,8 @@ benchmarks-collectives:
- weights

benchmarks-bridge-hubs:
stage: benchmarks-run
timeout: 1d
stage: benchmarks-run
timeout: 1d
extends:
- .collect-artifacts
- .benchmarks-refs
Expand Down
66 changes: 33 additions & 33 deletions scripts/ci/gitlab/pipeline/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Here are all jobs that are executed during "build" stage

build-linux-stable:
stage: build
stage: build
extends:
- .docker-env
- .common-refs
Expand All @@ -13,8 +13,8 @@ build-linux-stable:
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
- job: check-rustdoc
artifacts: false
script:
- echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
- time cargo build --release --locked --bin polkadot-parachain
Expand All @@ -25,19 +25,19 @@ build-linux-stable:
- echo ${CI_COMMIT_REF_NAME} | tee ./artifacts/VERSION

build-test-parachain:
stage: build
stage: build
extends:
- .docker-env
- .common-refs
- .collect-artifacts
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
artifacts: false
- job: check-rustdoc
artifacts: false
script:
- echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
- time cargo +nightly build --release --locked --bin test-parachain
Expand All @@ -48,25 +48,25 @@ build-test-parachain:
- 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
.build-runtime-template: &build-runtime-template
stage: build
extends:
- .docker-env
- .pr-refs
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
- job: check-rustdoc
artifacts: false
variables:
RUNTIME_PATH: "parachains/runtimes/assets"
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 ..;
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-bridge-hubs
Expand All @@ -75,49 +75,49 @@ build-test-parachain:
build-runtime-assets:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/assets"
RUNTIME_PATH: "parachains/runtimes/assets"

build-runtime-collectives:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/collectives"
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
- job: build-runtime-assets
artifacts: false

build-runtime-bridge-hubs:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/bridge-hubs"
RUNTIME_PATH: "parachains/runtimes/bridge-hubs"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-collectives
artifacts: false
- job: build-runtime-collectives
artifacts: false

build-runtime-contracts:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/contracts"
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
- job: build-runtime-collectives
artifacts: false

build-runtime-starters:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/starters"
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
- job: build-runtime-assets
artifacts: false

build-runtime-testing:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/testing"
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
- job: build-runtime-starters
artifacts: false
Loading

0 comments on commit 590387a

Please sign in to comment.