Skip to content

Refactory

Refactory #4

Workflow file for this run

name: Run benchmarks
on:
pull_request:
branches:
# - [main]
workflow_dispatch:
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-unknown-unknown
- name: Install protoc
uses: taiki-e/install-action@v1
with:
tool: protoc
- name: clone substrate-arkworks-examples for benchmarking
run: git clone https://github.com/achimcc/substrate-arkworks-examples
- name: ls
run: cd /home/runner/work && ls -la
- name: Compute benchmarks for main branch
run: |
cd substrate-arkworks-examples && \
cargo +nightly bench --bench arkworks \
| tee ../results-main.txt
- name: clone repo
run: git clone https://github.com/paritytech/ark-substrate
- name: Get patched Cargo.toml
run: cp ark-substrate/benchmarking/Cargo.toml substrate-arkworks-examples/Cargo.toml
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- name: Use current PR branch for benchmarking
run: sed -i 's,replace-with-pr-branch,${{ steps.branch-name.outputs.current_branch }},g' substrate-arkworks-examples/Cargo.toml
- name: Compute benchmarks for pr branch
run: |
cd substrate-arkworks-examples && \
cargo +nightly bench --bench arkworks \
| tee ../results-pr.txt
- name: cat pr
run: cat results-pr.txt
- name: cat main
run: cat results-main.txt
- name: Compare benchmark result
uses: openpgpjs/github-action-pull-request-benchmark@v1
with:
name: Time benchmark
tool: cargo
pr-benchmark-file-path: ./results-main.txt
base-benchmark-file-path: ./results-pr.txt
comment-on-alert: true
alert-threshold: 130%
fail-on-alert: true
fail-threshold: 150%
github-token: ${{ secrets.GITHUB_TOKEN }}