Revert "Remove most benchmarks" #344
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
on: | |
push: | |
branches: | |
- master | |
- drogus/benchmarks-improvements | |
workflow_dispatch: | |
inputs: | |
pr_number: | |
description: 'Pull Request Number' | |
required: false | |
default: '' | |
name: Benchmarks | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
benchmark: | |
name: run benchmarks | |
runs-on: benchmarks-runner | |
steps: | |
- name: Enable CPU boost | |
run: echo "1" | sudo tee /sys/devices/system/cpu/cpufreq/boost | |
- name: Checkout sources for a PR | |
if: ${{ github.event.inputs.ref }} | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.ref }} | |
fetch-depth: 0 | |
- name: Checkout sources | |
if: github.event.inputs.ref == '' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 10 | |
- name: Set up for PR context | |
if: github.event.inputs.pr_number | |
run: | | |
echo "PR_NUMBER=${{ github.event.inputs.pr_number }}" >> $GITHUB_ENV | |
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.inputs.pr_number }} --jq '{ baseRefName: .base.ref, headRefName: .head.ref }') | |
echo "PR_BASE_REF=$(echo $PR_DATA | jq -r '.baseRefName')" >> $GITHUB_ENV | |
echo "PR_HEAD_REF=$(echo $PR_DATA | jq -r '.headRefName')" >> $GITHUB_ENV | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
override: true | |
- name: Build | |
working-directory: crates/bench/ | |
run: | | |
cargo build --release | |
- name: Install clippy for module build | |
run: | | |
rustup component add clippy | |
- name: Disable CPU boost | |
run: echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost | |
- name: Criterion compare base branch | |
if: ${{ env.PR_BASE_REF }} | |
uses: clockworklabs/criterion-compare-action@main | |
with: | |
cwd: "crates/bench" | |
branchName: ${{ env.PR_BASE_REF }} | |
- name: Criterion compare previous commit | |
if: env.PR_BASE_REF == '' | |
uses: clockworklabs/criterion-compare-action@main | |
with: | |
cwd: "crates/bench" | |
branchName: "HEAD~1" | |
- name: Clean up | |
if: always() | |
run: | | |
rm -fr /stdb/* |