Split out benchmarking main branch and PRs #2
Workflow file for this run
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
name: Benchmark | |
on: | |
push: | |
branches: main | |
pull_request_target: | |
env: | |
CARGO_TERM_COLOR: always | |
BENCHER_PROJECT: trace4rs | |
BENCHER_ADAPTER: rust_criterion | |
BENCHER_TESTBED: ubuntu-latest | |
jobs: | |
benchmark_main_with_bencher: | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
name: Track main benchmarks with Bencher | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: bencherdev/bencher@main | |
- name: Benchmark trace4rs main with Bencher | |
run: | | |
bencher run \ | |
--branch main \ | |
--token "${{ secrets.BENCHER_API_TOKEN }}" \ | |
"cargo bench" | |
benchmark_pr_with_bencher: | |
if: github.event_name == 'pull_request_target' | |
name: Track PR benchmarks with Bencher | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
persist-credentials: false | |
- uses: bencherdev/bencher@main | |
- name: Benchmark trace4rs PR with Bencher | |
run: | | |
bencher run \ | |
--if-branch "${{ github.event.pull_request.head.ref }}" \ | |
--else-if-branch "${{ github.event.pull_request.base.ref }}" \ | |
--else-if-branch main \ | |
--err \ | |
--github-actions "${{ secrets.GITHUB_TOKEN }}" \ | |
--token "${{ secrets.BENCHER_API_TOKEN }}" \ | |
"cargo bench" |