From a44349f652a612860698260b2b2290e0527bb5f5 Mon Sep 17 00:00:00 2001 From: Andronik Date: Wed, 29 Dec 2021 15:10:40 +0100 Subject: [PATCH] custom cargo profiles for production (#4627) * add custom profiles and specify MSVR as 1.57 * fix host-perf-check command * use testnet profile for CI images * do not do lto for testnet profile * fix artifact path * test with testnet profile to reuse build artifacts * Revert "fix host-perf-check command" This reverts commit f1d15492204b8251685a97636cbb5a5f394f21da. * bump zombienet version Co-authored-by: Javier Viola --- polkadot/.gitlab-ci.yml | 15 +++++++-------- polkadot/Cargo.toml | 11 +++++++++++ polkadot/scripts/gitlab/test_linux_stable.sh | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/polkadot/.gitlab-ci.yml b/polkadot/.gitlab-ci.yml index 823e63b54f..b70f15ee25 100644 --- a/polkadot/.gitlab-ci.yml +++ b/polkadot/.gitlab-ci.yml @@ -27,7 +27,7 @@ variables: CI_IMAGE: "paritytech/ci-linux:production" DOCKER_OS: "debian:stretch" ARCH: "x86_64" - ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.1.3" + ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.1.4" VAULT_SERVER_URL: "https://vault.parity-mgmt-vault.parity.io" VAULT_AUTH_PATH: "gitlab-parity-io-jwt" VAULT_AUTH_ROLE: "cicd_gitlab_parity_${CI_PROJECT_NAME}" @@ -198,13 +198,12 @@ test-build-linux-stable: script: - ./scripts/gitlab/test_linux_stable.sh # we're using the bin built here, instead of having a parallel `build-linux-release` - # disputes feature is needed for zombie-net parachains malus test - - time cargo build --release --verbose --bin polkadot + - time cargo build --profile testnet --verbose --bin polkadot - sccache -s # pack artifacts - mkdir -p ./artifacts - VERSION="${CI_COMMIT_REF_NAME}" # will be tag or branch name - - mv ./target/release/polkadot ./artifacts/. + - mv ./target/testnet/polkadot ./artifacts/. - pushd artifacts - sha256sum polkadot | tee polkadot.sha256 - shasum -c polkadot.sha256 @@ -260,11 +259,11 @@ build-adder-collator: <<: *compiler-info <<: *rules-test-and-rococo script: - - time cargo build --release --verbose -p test-parachain-adder-collator + - time cargo build --profile testnet --verbose -p test-parachain-adder-collator - sccache -s # pack artifacts - mkdir -p ./artifacts - - mv ./target/release/adder-collator ./artifacts/. + - mv ./target/testnet/adder-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))" @@ -280,11 +279,11 @@ build-malus: - if: $CI_COMMIT_REF_NAME == "master" - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs script: - - time cargo build --release --verbose -p polkadot-test-malus + - time cargo build --profile testnet --verbose -p polkadot-test-malus - sccache -s # pack artifacts - mkdir -p ./artifacts - - mv ./target/release/malus ./artifacts/. + - mv ./target/testnet/malus ./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))" diff --git a/polkadot/Cargo.toml b/polkadot/Cargo.toml index 1eda0c0f49..beda86e5ef 100644 --- a/polkadot/Cargo.toml +++ b/polkadot/Cargo.toml @@ -9,6 +9,7 @@ license = "GPL-3.0-only" version = "0.9.13" authors = ["Parity Technologies "] edition = "2018" +rust-version = "1.57.0" # custom profiles readme = "README.md" [dependencies] @@ -114,6 +115,16 @@ opt-level = 3 # Polkadot runtime requires unwinding. panic = "unwind" +[profile.production] +inherits = "release" +lto = true + +[profile.testnet] +inherits = "release" +debug = true # debug symbols are useful for profilers +debug-assertions = true +overflow-checks = true + [features] runtime-benchmarks= [ "polkadot-cli/runtime-benchmarks" ] try-runtime = [ "polkadot-cli/try-runtime" ] diff --git a/polkadot/scripts/gitlab/test_linux_stable.sh b/polkadot/scripts/gitlab/test_linux_stable.sh index 7f11e08d9e..24f2a8b273 100755 --- a/polkadot/scripts/gitlab/test_linux_stable.sh +++ b/polkadot/scripts/gitlab/test_linux_stable.sh @@ -5,4 +5,4 @@ set -eux source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh" # Builds with the runtime benchmarks/metrics features are only to be used for testing. -time cargo test --workspace --release --verbose --locked --features=runtime-benchmarks,runtime-metrics +time cargo test --workspace --profile testnet --verbose --locked --features=runtime-benchmarks,runtime-metrics