# .gitlab-ci.yml # # cumulus # # pipelines can be triggered manually in the web stages: - test - publish - benchmarks-build - benchmarks-run default: interruptible: true retry: max: 2 when: - runner_system_failure - unknown_failure - 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" .collect-artifacts: &collect-artifacts artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" when: on_success expire_in: 1 days paths: - ./artifacts/ .rust-info-script: &rust-info-script - rustup show - cargo --version - rustup +nightly show - cargo +nightly --version - bash --version .publish-refs: &publish-refs rules: - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME == "master" # run from web and on master branch - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # run from web and on version tag (i.e. v1.0, v2.1rc1) - if: $CI_PIPELINE_SOURCE == "schedule" - 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: &benchmarks-manual-refs rules: - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9]+\.[0-9]+.*$/ # run from web and on branch release-parachains-v* (i.e. 1.0, 2.1rc1) when: manual - if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9]+\.[0-9]+.*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1 when: manual # run benchmarks only on release-parachains-v* branch .benchmarks-refs: &benchmarks-refs rules: - if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9]+\.[0-9]+.*$/ # run from web and on branch release-parachains-v* (i.e. 1.0, 2.1rc1) - if: $CI_COMMIT_REF_NAME =~ /^release-parachains-v[0-9]+\.[0-9]+.*$/ # i.e. release-parachains-v1.0, release-parachains-v2.1rc1 .docker-env: &docker-env image: "${CI_IMAGE}" before_script: - *rust-info-script tags: - linux-docker .kubernetes-env: &kubernetes-env image: "${CI_IMAGE}" tags: - kubernetes-parity-build .collect-artifacts: &collect-artifacts artifacts: name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}" when: on_success expire_in: 28 days paths: - ./artifacts/ #### stage: test test-linux-stable: stage: test <<: *docker-env rules: - if: $CI_COMMIT_REF_NAME == "master" - if: $CI_COMMIT_REF_NAME == "tags" - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs # It doesn't make sense to build on every commit, so we build on tags - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 variables: ARE_WE_RELEASING_YET: maybe! # web and schedule triggers can be provided with the non-empty variable ARE_WE_RELEASING_YET # to run building and publishing the binary. - if: $CI_PIPELINE_SOURCE == "web" - if: $CI_PIPELINE_SOURCE == "schedule" <<: *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" script: - time cargo test --all --release --locked -- --include-ignored # It's almost free to produce a binary here, please refrain from using it in production since # it goes with the debug assertions. - if [ "${ARE_WE_RELEASING_YET}" ]; then echo "___Building a binary___"; time cargo build --release --locked --bin polkadot-collator; echo "___Packing the artifacts___"; mkdir -p ./artifacts; mv ${CARGO_TARGET_DIR}/release/polkadot-collator ./artifacts/.; echo "___The VERSION is either a tag name or the curent branch if triggered not by a tag___"; echo ${CI_COMMIT_REF_NAME} | tee ./artifacts/VERSION; else exit 0; fi - sccache -s check-runtime-benchmarks: stage: test <<: *docker-env script: # Check that the node will compile with `runtime-benchmarks` feature flag. - time cargo check --all --features runtime-benchmarks # Check that parachain-template will compile with `runtime-benchmarks` feature flag. - time cargo check -p parachain-template-node --features runtime-benchmarks - sccache -s cargo-check-try-runtime: stage: test <<: *docker-env script: # Check that the node will compile with `try-runtime` feature flag. - time cargo check --all --features try-runtime # Check that parachain-template will compile with `try-runtime` feature flag. - time cargo check -p parachain-template-node --features try-runtime - sccache -s cargo-check-benches: stage: test <<: *docker-env script: - time cargo check --all --benches - sccache -s check-rustdoc: stage: test <<: *docker-env variables: SKIP_WASM_BUILD: 1 RUSTDOCFLAGS: "-Dwarnings" script: - time cargo +nightly doc --workspace --all-features --verbose --no-deps - sccache -s #### stage: publish publish-s3: stage: publish <<: *kubernetes-env image: paritytech/awscli:latest <<: *publish-refs variables: GIT_STRATEGY: none BUCKET: "releases.parity.io" PREFIX: "cumulus/${ARCH}-${DOCKER_OS}" before_script: # Job will fail if no artifacts were provided by test-linux-stable job. It's only possible for # this test to fail if the pipeline was triggered by web or schedule trigger without supplying # a nono-empty ARE_WE_RELEASING_YET variable. - test -e ./artifacts/polkadot-collator || ( echo "___No artifacts were provided by the previous job, please check the build there___"; exit 1 ) script: - echo "___Publishing a binary with debug assertions!___" - echo "___VERSION = $(cat ./artifacts/VERSION) ___" - aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/ - echo "___Updating objects in latest path___" - aws s3 sync s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/ s3://${BUCKET}/${PREFIX}/latest/ after_script: - aws s3 ls s3://${BUCKET}/${PREFIX}/latest/ --recursive --human-readable --summarize #### stage: benchmarks # Work only on release-parachains-v* branches benchmarks-build: stage: benchmarks-build <<: *docker-env <<: *collect-artifacts <<: *benchmarks-manual-refs script: - time cargo build --profile production --locked --features runtime-benchmarks - mkdir artifacts - cp target/production/polkadot-collator ./artifacts/ benchmarks: stage: benchmarks-run before_script: - *rust-info-script <<: *collect-artifacts <<: *benchmarks-refs script: - ./scripts/benchmarks-ci.sh statemine > ./artifacts/bench-statemine.log - ./scripts/benchmarks-ci.sh statemint > ./artifacts/bench-statemint.log - ./scripts/benchmarks-ci.sh westmint > ./artifacts/bench-westmint.log - git status - export BRANCHNAME="${CI_COMMIT_BRANCH}-weights" # Set git config - rm -rf .git/config - git config --global user.email "${GITHUB_EMAIL}" - git config --global user.name "${GITHUB_USER}" - git config remote.origin.url "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/paritytech/${CI_PROJECT_NAME}.git" - git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" # push results to github - git checkout -b $BRANCHNAME - git add polkadot-parachains/* - git commit -m "[benchmarks] pr with wieghts" - git push origin $BRANCHNAME # create PR - curl -u ${GITHUB_USER}:${GITHUB_TOKEN} -d '{"title":"[benchmarks] Update weights","body":"This PR is generated automatically by CI.","head":"'$BRANCHNAME'","base":"'${CI_COMMIT_BRANCH}'"}' -X POST https://api.github.com/repos/paritytech/${CI_PROJECT_NAME}/pulls after_script: - rm -rf .git/config tags: - weights