Files
pezkuwi-subxt/polkadot/scripts/ci/gitlab/pipeline/build.yml
T
Chevdor 693a29da1a Publish RC container images (#7556)
* WIP

* Add missing checkout

* Add debuggin

* Fix VAR name

* Bug fix

* Rework jobs

* Revert "Rework jobs"

This reverts commit 2bfa79fd3ae633c17403b838f9a5025f0f7fc3f3.

* Add cache

* Add temp default for testing

* Add missing checkout

* Fix patch

* Comment out the GPG check for now

* Rename polkadot_injected_release into a more appropriate polkadot_injected_debian

* Refactoring / renaming

* Introduce a generic image for binary injection

* Flag files to be deleted and changes to be done

* WIP

* Fix multi binaries images

* Add test build scripts

* Remove old file, add polkadot build-injected script

* Fix doc

* Fix tagging

* Add build of the injected container

* Fix for docker

* Remove the need for TTY

* Handling container publishing

* Fix owner and registry

* Fix vars

* Fix repo

* Fix var naming

* Fix case when there is no tag

* Fix case with no tag

* Handle error

* Fix spacings

* Fix tags

* Remove unnecessary grep that may fail

* Add final check

* Clean up and introduce GPG check

* Add doc

* Add doc

* Update doc/docker.md

Co-authored-by: Mira Ressel <mira@parity.io>

* type

Co-authored-by: Mira Ressel <mira@parity.io>

* Fix used VAR

* Improve doc

* ci: Update .build-push-image jobs to use the new build-injected.sh

* ci: fix path to build-injected.sh script

* Rename the release artifacts folder to prevent confusion due to a similar folder in the gitlab CI

* ci: check out polkadot repo in .build-push-image

This seems far cleaner than copying the entire scripts/ folder into our
job artifacts.

* feat(build-injected.sh): make PROJECT_ROOT configurable

This lets us avoid a dependency on git in our CI image.

* ci: build injected images with buildah

* ci: pass full image names to zombienet

* Add missing ignore

---------

Co-authored-by: Mira Ressel <mira@parity.io>
2023-08-11 15:28:39 +02:00

175 lines
6.2 KiB
YAML

# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "build" stage
build-linux-stable:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
- .compiler-info
- .collect-artifacts
variables:
RUST_TOOLCHAIN: stable
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
# Ensure we run the UI tests.
RUN_UI_TESTS: 1
script:
- time cargo build --locked --profile testnet --features pyroscope,fast-runtime --verbose --bins
# pack artifacts
- mkdir -p ./artifacts
- VERSION="${CI_COMMIT_REF_NAME}" # will be tag or branch name
- mv ./target/testnet/polkadot ./artifacts/.
- mv ./target/testnet/polkadot-prepare-worker ./artifacts/.
- mv ./target/testnet/polkadot-execute-worker ./artifacts/.
- pushd artifacts
- sha256sum polkadot | tee polkadot.sha256
- shasum -c polkadot.sha256
- popd
- EXTRATAG="${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
- echo "Polkadot version = ${VERSION} (EXTRATAG = ${EXTRATAG})"
- echo -n ${VERSION} > ./artifacts/VERSION
- echo -n ${EXTRATAG} > ./artifacts/EXTRATAG
- echo -n ${CI_JOB_ID} > ./artifacts/BUILD_LINUX_JOB_ID
- RELEASE_VERSION=$(./artifacts/polkadot -V | awk '{print $2}'| awk -F "-" '{print $1}')
- echo -n "v${RELEASE_VERSION}" > ./artifacts/BUILD_RELEASE_VERSION
build-test-collators:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
- .compiler-info
- .collect-artifacts
script:
- time cargo build --locked --profile testnet --verbose -p test-parachain-adder-collator
- time cargo build --locked --profile testnet --verbose -p test-parachain-undying-collator
# pack artifacts
- mkdir -p ./artifacts
- mv ./target/testnet/adder-collator ./artifacts/.
- mv ./target/testnet/undying-collator ./artifacts/.
- echo -n "${CI_COMMIT_REF_NAME}" > ./artifacts/VERSION
- echo -n "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" > ./artifacts/EXTRATAG
- echo "adder-collator version = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
- echo "undying-collator version = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
build-malus:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
- .compiler-info
- .collect-artifacts
script:
- time cargo build --locked --profile testnet --verbose -p polkadot-test-malus
# pack artifacts
- mkdir -p ./artifacts
- mv ./target/testnet/malus ./artifacts/.
- mv ./target/testnet/polkadot-execute-worker ./artifacts/.
- mv ./target/testnet/polkadot-prepare-worker ./artifacts/.
- echo -n "${CI_COMMIT_REF_NAME}" > ./artifacts/VERSION
- echo -n "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" > ./artifacts/EXTRATAG
- echo "polkadot-test-malus = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
build-staking-miner:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
extends:
- .docker-env
- .common-refs
- .compiler-info
- .collect-artifacts
script:
- time cargo build --locked --release --package staking-miner
# pack artifacts
- mkdir -p ./artifacts
- mv ./target/release/staking-miner ./artifacts/.
- echo -n "${CI_COMMIT_REF_NAME}" > ./artifacts/VERSION
- echo -n "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}" > ./artifacts/EXTRATAG
- echo "staking-miner = $(cat ./artifacts/VERSION) (EXTRATAG = $(cat ./artifacts/EXTRATAG))"
build-rustdoc:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in test.yml
needs:
- job: test-deterministic-wasm
artifacts: false
extends:
- .docker-env
- .test-refs
variables:
SKIP_WASM_BUILD: 1
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}-doc"
when: on_success
expire_in: 1 days
paths:
- ./crate-docs/
script:
# FIXME: it fails with `RUSTDOCFLAGS="-Dwarnings"` and `--all-features`
# FIXME: return to stable when https://github.com/rust-lang/rust/issues/96937 gets into stable
- time cargo doc --workspace --verbose --no-deps
- rm -f ./target/doc/.lock
- mv ./target/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=polkadot_service/index.html>" > ./crate-docs/index.html
build-implementers-guide:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in test.yml
needs:
- job: test-deterministic-wasm
artifacts: false
extends:
- .kubernetes-env
- .test-refs
- .collect-artifacts-short
# git depth is set on purpose: https://github.com/paritytech/polkadot/issues/6284
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
CI_IMAGE: paritytech/mdbook-utils:e14aae4a-20221123
script:
- mdbook build ./roadmap/implementers-guide
- mkdir -p artifacts
- mv roadmap/implementers-guide/book artifacts/
build-short-benchmark:
stage: build
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
# the job can be found in check.yml
needs:
- job: job-starter
artifacts: false
extends:
- .docker-env
- .test-refs
- .collect-artifacts
script:
- cargo build --profile release --locked --features=runtime-benchmarks
- mkdir artifacts
- cp ./target/release/polkadot ./artifacts/