name: Benchmark Pull Request Track
on:
workflow_run:
workflows: [Benchmark Pull Request]
types: [completed]
permissions:
checks: write
pull-requests: write
jobs:
track:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: bencherdev/bencher@main
- name: Download benchmark results
uses: actions/download-artifact@v4
with:
name: bench_results
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Download PR event
uses: actions/download-artifact@v4
with:
name: pr_event
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Get PR metadata
id: pr
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const event = JSON.parse(fs.readFileSync('event.json', 'utf8'));
core.setOutput('head_ref', event.pull_request.head.ref);
core.setOutput('base_ref', event.pull_request.base.ref);
core.setOutput('pr_number', event.pull_request.number);
- name: Track benchmarks
run: |
bencher run \
--project zyn \
--token '${{ secrets.BENCHER_API_TOKEN }}' \
--branch '${{ steps.pr.outputs.head_ref }}' \
--start-point main \
--start-point-clone-thresholds \
--testbed ubuntu-latest \
--adapter rust_bench \
--threshold-measure latency \
--threshold-test t_test \
--threshold-upper-boundary 0.95 \
--github-actions '${{ secrets.GITHUB_TOKEN }}' \
--err \
--file output.txt