From 6050b27baeefa024b45d2d093c049265bd1ae4ba Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Wed, 14 Aug 2024 13:57:44 +1200 Subject: [PATCH] update to use omni bencher --- .github/workflows/benchmark.yml | 16 +++++++++------- .github/workflows/coverage.yml | 2 +- .github/workflows/test.yml | 8 ++++---- Makefile | 16 ++++++++-------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e865a61430..75dd700307 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -11,7 +11,7 @@ jobs: if: ${{ github.event.issue.pull_request && contains(fromJson('["MEMBER", "OWNER"]'), github.event.comment.author_association) && startsWith(github.event.comment.body, '/bench ') }} runs-on: [self-hosted, linux] steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 name: Get PR branch id: issue with: @@ -30,7 +30,7 @@ jobs: with: submodules: recursive ref: ${{ fromJson(steps.issue.outputs.result).sha }} - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 name: Prepare command id: command with: @@ -54,7 +54,7 @@ jobs: default: throw new Error('Invalid command') } - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 name: Post comment id: comment with: @@ -71,7 +71,7 @@ jobs: ` }) return data.data.id - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -82,13 +82,15 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@nightly - name: Install weight-gen - run: cargo install --git https://github.com/open-web3-stack/wasm-bencher.git --bin weight-gen --force + run: cargo install --git https://github.com/open-web3-stack/wasm-bencher.git --bin weight-gen + - name: Install omni-bencher + run: cargo install frame-omni-bencher - name: Setup cmake uses: jwlawson/actions-setup-cmake@v1.12 - name: Use Node.js uses: actions/setup-node@v4 with: - node-version: 18.x + node-version: 20.x - name: Run benchmarks run: ${{steps.command.outputs.result}} > ${{runner.temp}}/out.txt - name: Commit @@ -98,7 +100,7 @@ jobs: git add . git commit -m '${{github.event.comment.body}}' --allow-empty git push origin HEAD:${{ fromJson(steps.issue.outputs.result).ref }} - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 name: Update comment with: script: | diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 893387c3d5..8201faa640 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 091cbdf048..eef3903719 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -61,7 +61,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -85,7 +85,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -117,7 +117,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ diff --git a/Makefile b/Makefile index acb1a3374d..567657bd6d 100644 --- a/Makefile +++ b/Makefile @@ -257,23 +257,23 @@ endif ifeq ($(words $(pallet_folder)), 0) $(error pallet_folder not defined) endif - cargo run $(options) --release --bin=acala --features=runtime-benchmarks --features=with-mandala-runtime -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=$(pallet) --extrinsic="*" --wasm-execution=compiled --heap-pages=4096 --output=./modules/$(pallet_folder)/src/weights.rs --template=./templates/module-weight-template.hbs + cargo build $(options) --release --features=runtime-benchmarks -p mandala-runtime + frame-omni-bencher v1 benchmark pallet --runtime target/release/wbuild/mandala-runtime/mandala_runtime.compact.compressed.wasm --steps=50 --repeat=20 --pallet=$(pallet) --extrinsic="*" --heap-pages=4096 --output=./modules/$(pallet_folder)/src/weights.rs --template=./templates/module-weight-template.hbs .PHONY: benchmark-mandala benchmark-mandala: - cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-mandala-runtime -- benchmark pallet --chain=dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/ + cargo build $(options) --release --features=runtime-benchmarks -p mandala-runtime + frame-omni-bencher v1 pallet --runtime target/release/wbuild/mandala-runtime/mandala_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/mandala/src/weights/ .PHONY: benchmark-karura benchmark-karura: - cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-karura-runtime -- benchmark pallet --chain=karura-dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/ + cargo build $(options) --release --features=runtime-benchmarks -p karura-runtime + frame-omni-bencher v1 pallet --runtime target/release/wbuild/karura-runtime/karura_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/karura/src/weights/ .PHONY: benchmark-acala benchmark-acala: - cargo run $(options) --bin=acala --profile production --features=runtime-benchmarks --features=with-acala-runtime -- benchmark pallet --chain=acala-dev --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/ - -.PHONY: benchmark-machine -benchmark-machine: - cargo run --profile production --features=with-acala-runtime -- benchmark machine --chain=acala-dev + cargo build $(options) --release --features=runtime-benchmarks -p acala-runtime + frame-omni-bencher v1 pallet --runtime target/release/wbuild/acala-runtime/acala_runtime.compact.compressed.wasm --steps=50 --repeat=20 '--pallet=$(or $(pallet),*)' '--extrinsic=*' --wasm-execution=compiled --heap-pages=4096 --template=./templates/runtime-weight-template.hbs --output=./runtime/acala/src/weights/ .PHONY: clippy-fix clippy-fix: