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

custom cargo profiles for production #4627

Merged
merged 9 commits into from
Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))"
Expand All @@ -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))"
Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ license = "GPL-3.0-only"
version = "0.9.13"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
rust-version = "1.57.0" # custom profiles
readme = "README.md"

[dependencies]
Expand Down Expand Up @@ -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" ]
Expand Down
2 changes: 1 addition & 1 deletion scripts/gitlab/test_linux_stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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