Skip to content

Benchmarks Run for

Benchmarks Run for #90

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Benchmarks Run
run-name: Benchmarks Run for ${{github.event.inputs.branch}}
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
on:
push:
workflow_dispatch:
inputs:
branch:
description: "Branch"
required: true
pallets:
description: "Specific Pallets? (Ex: 'msa,messages')"
required: true
default: all
jobs:
build:
if: github.repository == 'frequency-chain/frequency'
name: Build Benchmark Binary
runs-on: ubicloud-standard-16
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.4.0
permissions:
contents: read
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.branch}}
- name: Build Binary for Benchmarks
run: |
echo "Running benchmark binary builder..."
./scripts/run_benchmarks.sh -b
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
name: benchmark-binary
path: target/release/frequency
retention-days: 3
- name: Upload WASM Build Artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: target/release/wbuild
retention-days: 3
run-benchmarks:
if: github.repository == 'frequency-chain/frequency'
name: Run Benchmarks
needs: build
runs-on: [self-hosted, Linux, X64, benchmark]
permissions:
contents: write
statuses: write
pull-requests: write
steps:
- name: Print Info
run: |
echo "Running benchmarks..."
echo "Pallets: ${{github.event.inputs.pallets}}"
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.branch}}
- name: Create Target Directory
run: mkdir -p target/release
- name: Download Benchmark Binary
uses: actions/download-artifact@v4
with:
name: benchmark-binary
path: target/release
- name: Download WASM Build Artifacts
uses: actions/download-artifact@v4
with:
name: wasm-artifacts
path: target/release/wbuild
- name: Make Binary Executable
run: chmod +x target/release/frequency
- name: Update Weights
run: |
rustup show
pallets_str="${{github.event.inputs.pallets}}"
echo "Pallets: $pallets_str"
if [ -z "${pallets_str}" -o $pallets_str = 'all' ]; then
echo "Running benchmarks for all pallets..."
./scripts/run_benchmarks.sh -s -n
else
IFS=',' read -r -a pallets <<< "$pallets_str"
echo "Running benchmarks for pallets: ${pallets[*]}..."
./scripts/run_benchmarks.sh -s -n "${pallets[@]}"
echo "Finished benchmarks for pallets: ${pallets[*]}."
fi
- name: Print Updated Weights
run: |
git status
git diff
- name: Commit Updated Weights
id: commit-updated-weights
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842
with:
commit_message: "Update weights"
file_pattern: "pallets/**/*.rs runtime/common/src/weights/*"
test:
if: github.repository == 'frequency-chain/frequency'
name: Post Benchmark Tests
needs: run-benchmarks
runs-on: ubicloud-standard-16
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.4.0
permissions:
contents: read
steps:
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.branch}}
- name: Current Commit
run: git log -n 1
- name: Run Tests
run: cargo test --features runtime-benchmarks,frequency-lint-check --workspace --release