Skip to content

Commit

Permalink
simplify benchmarking (#585)
Browse files Browse the repository at this point in the history
* disable logs during benchmarking

* Use wildcard for pallet selector

* re-add log filter

* tinker around more

* disable runtime change check

* add workflow dispatch trigger

* properly disable check for runtime changes
  • Loading branch information
KaiserKarel authored Feb 3, 2022
1 parent 66515ea commit 941ed60
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 41 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- releases
- main
workflow_dispatch:

jobs:
benchmark:
Expand Down Expand Up @@ -36,15 +37,14 @@ jobs:
id: branch-name
uses: tj-actions/branch-names@v5.1

- name: Check for runtime changes
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
GITHUB_BRANCH_NAME: ${{ steps.branch-name.outputs.current_branch }}
# - name: Check for runtime changes
# env:
# BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
# GITHUB_BRANCH_NAME: ${{ steps.branch-name.outputs.current_branch }}

id: check_runtime
#if: github.event.label.name == 'needs-benchmarks'
if: contains( github.event.pull_request.labels.*.name, 'needs-benchmarks')
run: .maintain/check_runtime.sh
# id: check_runtime
# if: contains( github.event.pull_request.labels.*.name, 'needs-benchmarks')
# run: .maintain/check_runtime.sh

- name: Benchmark Test
env:
Expand Down
47 changes: 14 additions & 33 deletions .maintain/run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,6 @@ VERSIONS_FILES=(
steps=50
repeat=20

pallets=(
oracle
frame_system
timestamp
session
balances
indices
membership
treasury
scheduler
collective
democracy
collator_selection
utility
lending
dutch_auction
)

/home/runner/.cargo/bin/rustup install nightly
/home/runner/.cargo/bin/rustup target add wasm32-unknown-unknown --toolchain nightly
/home/runner/.cargo/bin/cargo build --release -p composable --features=runtime-benchmarks
Expand All @@ -45,18 +27,17 @@ run_benchmarks() {
# shellcheck disable=SC2068
echo "Running benchmarks for $CHAIN"
# shellcheck disable=SC2068
for p in ${pallets[@]}; do
./target/release/composable benchmark \
--chain="$CHAIN" \
--execution=wasm \
--wasm-execution=compiled \
--pallet="$p" \
--extrinsic='*' \
--steps=$steps \
--repeat=$repeat \
--raw \
--output="$OUTPUT"
done
./target/release/composable benchmark \
--chain="$CHAIN" \
--execution=wasm \
--wasm-execution=compiled \
--pallet="*" \
--extrinsic='*' \
--steps=$steps \
--repeat=$repeat \
--raw \
--output="$OUTPUT" \
--log error
git config --global user.email "haroldsphinx@gmail.com"
git config --global user.name "haroldsphinx"
USERNAME=$(gcloud secrets versions access latest --secret=github-api-username)
Expand All @@ -71,8 +52,8 @@ run_benchmarks() {

for i in "${VERSIONS_FILES[@]}"; do
while IFS=',' read -r output chain folder; do
if has_runtime_changes "${BASE_BRANCH}" "${GITHUB_BRANCH_NAME}" "$folder"; then
run_benchmarks $output $chain $folder
fi
# if has_runtime_changes "${BASE_BRANCH}" "${GITHUB_BRANCH_NAME}" "$folder"; then
run_benchmarks $output $chain $folder
# fi
done <<<"$i"
done

0 comments on commit 941ed60

Please sign in to comment.