Files
pezkuwi-subxt/substrate/scripts/ci/gitlab/pipeline/build.yml
T
Mira Ressel 378f68a6d1 Fail dependant checks on cargo check warnings (#13922)
* Fail dependant checks on cargo check warnings

* Adjust feature flags for check-dependent-polkadot
2023-04-14 14:16:17 +02:00

178 lines
6.2 KiB
YAML

# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "build" stage
# PIPELINE_SCRIPTS_TAG can be found in the project variables
.check-dependent-project:
stage: build
# DAG: this is artificial dependency
needs:
- job: cargo-clippy
artifacts: false
extends:
- .docker-env
- .test-refs-no-trigger-prs-only
variables:
RUSTFLAGS: "-D warnings"
script:
- git clone
--depth=1
--branch="$PIPELINE_SCRIPTS_TAG"
https://github.com/paritytech/pipeline-scripts
- ./pipeline-scripts/check_dependent_project.sh
--org paritytech
--dependent-repo "$DEPENDENT_REPO"
--github-api-token "$GITHUB_PR_TOKEN"
--extra-dependencies "$EXTRA_DEPENDENCIES"
--companion-overrides "$COMPANION_OVERRIDES"
# Individual jobs are set up for each dependent project so that they can be ran in parallel.
# Arguably we could generate a job for each companion in the PR's description using Gitlab's
# parent-child pipelines but that's more complicated.
check-dependent-polkadot:
extends: .check-dependent-project
variables:
DEPENDENT_REPO: polkadot
COMPANION_OVERRIDES: |
substrate: polkadot-v*
polkadot: release-v*
# enable the same feature flags as polkadot's test-linux-stable
COMPANION_CHECK_COMMAND: >
cargo check --all-targets --workspace
--features=runtime-benchmarks,runtime-metrics,try-runtime
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ #PRs
check-dependent-cumulus:
extends: .check-dependent-project
variables:
DEPENDENT_REPO: cumulus
EXTRA_DEPENDENCIES: polkadot
COMPANION_OVERRIDES: |
substrate: polkadot-v*
polkadot: release-v*
rules:
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ #PRs
build-linux-substrate:
stage: build
extends:
- .collect-artifacts
- .docker-env
- .build-refs
variables:
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
needs:
- job: test-linux-stable
artifacts: false
before_script:
- !reference [.timestamp, before_script]
- !reference [.job-switcher, before_script]
- mkdir -p ./artifacts/substrate/
- !reference [.rusty-cachier, before_script]
# tldr: we need to checkout the branch HEAD explicitly because of our dynamic versioning approach while building the substrate binary
# see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589
- git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
script:
- rusty-cachier snapshot create
- WASM_BUILD_NO_COLOR=1 time cargo build --locked --release --verbose
- mv $CARGO_TARGET_DIR/release/substrate ./artifacts/substrate/.
- echo -n "Substrate version = "
- if [ "${CI_COMMIT_TAG}" ]; then
echo "${CI_COMMIT_TAG}" | tee ./artifacts/substrate/VERSION;
else
./artifacts/substrate/substrate --version |
cut -d ' ' -f 2 | tee ./artifacts/substrate/VERSION;
fi
- sha256sum ./artifacts/substrate/substrate | tee ./artifacts/substrate/substrate.sha256
- cp -r ./scripts/ci/docker/substrate.Dockerfile ./artifacts/substrate/
- printf '\n# building node-template\n\n'
- ./scripts/ci/node-template-release.sh ./artifacts/substrate/substrate-node-template.tar.gz
- rusty-cachier cache upload
.build-subkey:
stage: build
extends:
- .collect-artifacts
- .docker-env
- .publish-refs
variables:
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
before_script:
- !reference [.timestamp, before_script]
- !reference [.job-switcher, before_script]
- mkdir -p ./artifacts/subkey
- !reference [.rusty-cachier, before_script]
script:
- rusty-cachier snapshot create
- cd ./bin/utils/subkey
- SKIP_WASM_BUILD=1 time cargo build --locked --release --verbose
- cd -
- mv $CARGO_TARGET_DIR/release/subkey ./artifacts/subkey/.
- echo -n "Subkey version = "
- ./artifacts/subkey/subkey --version |
sed -n -E 's/^subkey ([0-9.]+.*)/\1/p' |
tee ./artifacts/subkey/VERSION;
- sha256sum ./artifacts/subkey/subkey | tee ./artifacts/subkey/subkey.sha256
- cp -r ./scripts/ci/docker/subkey.Dockerfile ./artifacts/subkey/
- rusty-cachier cache upload
build-subkey-linux:
extends: .build-subkey
build-subkey-macos:
extends: .build-subkey
# duplicating before_script & script sections from .build-subkey hidden job
# to overwrite rusty-cachier integration as it doesn't work on macos
before_script:
# skip timestamp script, the osx bash doesn't support printf %()T
- !reference [.job-switcher, before_script]
- mkdir -p ./artifacts/subkey
script:
- cd ./bin/utils/subkey
- SKIP_WASM_BUILD=1 time cargo build --locked --release --verbose
- cd -
- mv ./target/release/subkey ./artifacts/subkey/.
- echo -n "Subkey version = "
- ./artifacts/subkey/subkey --version |
sed -n -E 's/^subkey ([0-9.]+.*)/\1/p' |
tee ./artifacts/subkey/VERSION;
- sha256sum ./artifacts/subkey/subkey | tee ./artifacts/subkey/subkey.sha256
- cp -r ./scripts/ci/docker/subkey.Dockerfile ./artifacts/subkey/
after_script: [""]
tags:
- osx
build-rustdoc:
stage: build
extends:
- .docker-env
- .test-refs
variables:
SKIP_WASM_BUILD: 1
DOC_INDEX_PAGE: "sc_service/index.html" # default redirected page
# this variable gets overriden by "rusty-cachier environment inject", use the value as default
CARGO_TARGET_DIR: "$CI_PROJECT_DIR/target"
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc"
when: on_success
expire_in: 7 days
paths:
- ./crate-docs/
# DAG: this is artificial dependency
needs:
- job: cargo-clippy
artifacts: false
script:
- rusty-cachier snapshot create
- time cargo doc --locked --workspace --all-features --verbose --no-deps
- rm -f $CARGO_TARGET_DIR/doc/.lock
- mv $CARGO_TARGET_DIR/doc ./crate-docs
# FIXME: remove me after CI image gets nonroot
- chown -R nonroot:nonroot ./crate-docs
- echo "<meta http-equiv=refresh content=0;url=${DOC_INDEX_PAGE}>" > ./crate-docs/index.html
- rusty-cachier cache upload