Benchmarks #184
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmarks | |
on: | |
workflow_dispatch: | |
inputs: | |
change-type: | |
description: How should changes be made after the benchmarks are completed? | |
required: true | |
default: ignore | |
type: choice | |
options: | |
- ignore | |
- commit | |
- pull_request | |
env: | |
CARGO_TERM_COLOR: always | |
TERM: xterm-256color | |
jobs: | |
benchmarks: | |
runs-on: bench | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
RUSTUP_HOME: /tmp/rustup_home | |
steps: | |
- name: "ACTIONS: Checkout" | |
uses: actions/checkout@v4 | |
- name: "Install: Rust toolchain" | |
uses: dsherret/rust-toolchain-file@v1 | |
- name: "Install: Build deps" | |
run: | | |
sudo apt update | |
sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake wabt protobuf-compiler wget bzip2 | |
- name: Run all benchmarks | |
run: | | |
./scripts/benchmarking/run_all_benchmarks.sh -c vara-dev -m | |
cp ./scripts/benchmarking/weights-output/* runtime/vara/src/weights | |
# apply some patches for `pallets/gear/src/weights.rs` | |
cp runtime/vara/src/weights/pallet_gear.rs pallets/gear/src/weights.rs | |
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear/src/weights.rs | |
# apply some patches for `pallets/gear-builtin/src/weights.rs` | |
cp runtime/vara/src/weights/pallet_gear_builtin.rs pallets/gear-builtin/src/weights.rs | |
sed -i -E 's/\w+::WeightInfo for SubstrateWeight/WeightInfo for SubstrateWeight/' pallets/gear-builtin/src/weights.rs | |
# generate code for lightweight scheduler that is used in gtest and other crates | |
./scripts/weight-dump.sh | |
- name: Clear target directory | |
if: ${{ always() }} | |
run: | | |
# clear the target directory because our benchmarking machine is not ephemeral | |
cargo clean | |
- name: "ACTIONS: Upload artifact with benchmarking errors (if exist)" | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmarking-errors | |
path: scripts/benchmarking/benchmarking_errors.txt | |
if-no-files-found: ignore | |
- name: "ACTIONS: Upload artifact with updated weights (vara)" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: weights-vara | |
path: | | |
runtime/vara/src/weights/ | |
utils/wasm-instrument/src/gas_metering/ | |