From 2f0ac90911f0553b4cf3b5d6adddbc1bda6820b5 Mon Sep 17 00:00:00 2001 From: gpwclark Date: Fri, 19 Jul 2024 01:48:13 -0400 Subject: [PATCH] run iai and criterion benches --- .github/workflows/pr_benchmarks.yml | 34 +++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_benchmarks.yml b/.github/workflows/pr_benchmarks.yml index dbc371b7a0..a5d076ca81 100644 --- a/.github/workflows/pr_benchmarks.yml +++ b/.github/workflows/pr_benchmarks.yml @@ -26,8 +26,7 @@ jobs: if: github.event.pull_request.merged == true || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository run: echo "branch_name=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT" - - benchmark_pr_with_bencher: + benchmark_pr_with_bencher_iai: needs: [target_branch, backup_branch] permissions: pull-requests: write @@ -56,3 +55,34 @@ jobs: --token "${{ secrets.BENCHER_API_TOKEN }}" \ --err \ "cargo bench --all" + + benchmark_pr_with_bencher_criterion: + needs: [target_branch, backup_branch] + permissions: + pull-requests: write + name: Continuous Benchmarking with Bencher + runs-on: ubuntu-latest + env: + BENCHER_PROJECT: sl-sh + BENCHER_TESTBED: ubuntu-latest + BENCHER_ADAPTER: rust_criterion + BRANCH: ${{ needs.target_branch.outputs.branch_name || needs.backup_branch.outputs.branch_name || github.event.pull_request.base.ref || 'main' }} + steps: + - run: sudo apt-get update + - run: sudo apt install -y valgrind gnuplot + - uses: actions/checkout@v4 + - uses: bencherdev/bencher@main + - run: cargo install iai-callgrind-runner --version 0.10.2 + - name: cargo test --no-run benches (debug mode) to check compile + run: cargo test --benches --no-run + + - name: Track Benchmarks with Bencher + run: | + echo "Running bencher for branch ${BRANCH}." + bencher run \ + --if-branch "${BRANCH}" \ + --else-if-branch "main" \ + --github-actions "${{ secrets.GITHUB_TOKEN }}" \ + --token "${{ secrets.BENCHER_API_TOKEN }}" \ + --err \ + "cargo bench --all"