[ci] scripts: don't rebuild for every pallet benchmark (#5126)

* scripts: don't rebuild for every pallet benchmark

* ci: remove orphan variable

* [ci] run_benches_for_runtime.sh: explicit relative path names

* [ci] scripts: handle failing benchmarks
This commit is contained in:
Mara Robin B
2022-03-15 15:59:33 +01:00
committed by GitHub
parent 109c422149
commit 2c8ea1e0e4
2 changed files with 18 additions and 20 deletions
+1 -4
View File
@@ -514,13 +514,12 @@ update_polkadot_weights: &update-weights
stage: stage2 stage: stage2
when: manual when: manual
variables: variables:
PROFILE: production
RUNTIME: polkadot RUNTIME: polkadot
artifacts: artifacts:
paths: paths:
- ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch - ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch
script: script:
- ./scripts/run_benches_for_runtime.sh $RUNTIME $PROFILE - ./scripts/run_benches_for_runtime.sh $RUNTIME
- git diff -P > ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch - git diff -P > ${RUNTIME}_weights_${CI_COMMIT_SHORT_SHA}.patch
# uses the "shell" executors # uses the "shell" executors
tags: tags:
@@ -529,13 +528,11 @@ update_polkadot_weights: &update-weights
update_kusama_weights: update_kusama_weights:
<<: *update-weights <<: *update-weights
variables: variables:
PROFILE: production
RUNTIME: kusama RUNTIME: kusama
update_westend_weights: update_westend_weights:
<<: *update-weights <<: *update-weights
variables: variables:
PROFILE: production
RUNTIME: westend RUNTIME: westend
#### stage: stage3 #### stage: stage3
+17 -16
View File
@@ -1,17 +1,18 @@
#!/bin/bash #!/bin/bash
set -e
# Runs all benchmarks for all pallets, for a given runtime, provided by $1 # Runs all benchmarks for all pallets, for a given runtime, provided by $1
# Should be run on a reference machine to gain accurate benchmarks # Should be run on a reference machine to gain accurate benchmarks
# current reference machine: https://github.com/paritytech/substrate/pull/5848 # current reference machine: https://github.com/paritytech/substrate/pull/5848
runtime="$1" runtime="$1"
profile="$2"
standard_args="--profile $profile --locked --features=runtime-benchmarks"
echo "[+] Running all benchmarks for $runtime" echo "[+] Running all benchmarks for $runtime"
# shellcheck disable=SC2086 cargo +nightly build --profile production --locked --features=runtime-benchmarks
cargo +nightly run $standard_args benchmark \
./target/production/polkadot benchmark \
--chain "${runtime}-dev" \ --chain "${runtime}-dev" \
--list |\ --list |\
tail -n+2 |\ tail -n+2 |\
@@ -23,17 +24,17 @@ cargo +nightly run $standard_args benchmark \
while read -r line; do while read -r line; do
pallet="$(echo "$line" | cut -d' ' -f1)"; pallet="$(echo "$line" | cut -d' ' -f1)";
echo "Runtime: $runtime. Pallet: $pallet"; echo "Runtime: $runtime. Pallet: $pallet";
# shellcheck disable=SC2086 # '!' has the side effect of bypassing errexit / set -e
cargo +nightly run $standard_args -- benchmark \ ! ./target/production/polkadot benchmark \
--chain="${runtime}-dev" \ --chain="${runtime}-dev" \
--steps=50 \ --steps=50 \
--repeat=20 \ --repeat=20 \
--pallet="$pallet" \ --pallet="$pallet" \
--extrinsic="*" \ --extrinsic="*" \
--execution=wasm \ --execution=wasm \
--wasm-execution=compiled \ --wasm-execution=compiled \
--heap-pages=4096 \ --heap-pages=4096 \
--header=./file_header.txt \ --header=./file_header.txt \
--output="./runtime/${runtime}/src/weights/${pallet/::/_}.rs" --output="./runtime/${runtime}/src/weights/${pallet/::/_}.rs"
done < "${runtime}_pallets" done < "${runtime}_pallets"
rm "${runtime}_pallets" rm "${runtime}_pallets"