Benchmarks (PR track) #77
This file contains hidden or 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
| # Track PR benchmark results on bencher.dev (runs after bench-pr-run completes) | |
| # This workflow runs in the context of the default branch, so secrets are available | |
| name: Benchmarks (PR track) | |
| on: | |
| workflow_run: | |
| workflows: ["Benchmarks (PR run)"] | |
| types: [completed] | |
| jobs: | |
| track: | |
| if: github.event.workflow_run.conclusion == 'success' | |
| permissions: | |
| checks: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| env: | |
| BENCHMARK_RESULTS: benchmark_results.json | |
| PR_EVENT: event.json | |
| steps: | |
| - name: Download benchmark results | |
| uses: dawidd6/action-download-artifact@v21 | |
| with: | |
| name: ${{ env.BENCHMARK_RESULTS }} | |
| run_id: ${{ github.event.workflow_run.id }} | |
| - name: Download PR event | |
| uses: dawidd6/action-download-artifact@v21 | |
| with: | |
| name: ${{ env.PR_EVENT }} | |
| run_id: ${{ github.event.workflow_run.id }} | |
| - name: Export PR event data | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| let fs = require('fs'); | |
| let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT, {encoding: 'utf8'})); | |
| core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref); | |
| core.exportVariable("PR_HEAD_SHA", prEvent.pull_request.head.sha); | |
| core.exportVariable("PR_BASE", prEvent.pull_request.base.ref); | |
| core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha); | |
| core.exportVariable("PR_NUMBER", prEvent.number); | |
| - name: Install Bencher CLI | |
| uses: bencherdev/bencher@v0.6.4 | |
| - name: Track PR benchmarks with Bencher | |
| run: | | |
| bencher run \ | |
| --project anndatar \ | |
| --token '${{ secrets.BENCHER_API_TOKEN }}' \ | |
| --branch "$PR_HEAD" \ | |
| --hash "$PR_HEAD_SHA" \ | |
| --start-point "$PR_BASE" \ | |
| --start-point-hash "$PR_BASE_SHA" \ | |
| --start-point-clone-thresholds \ | |
| --start-point-reset \ | |
| --testbed ubuntu-latest \ | |
| --threshold-measure latency \ | |
| --threshold-test t_test \ | |
| --threshold-max-sample-size 64 \ | |
| --threshold-upper-boundary 0.99 \ | |
| --threshold-measure memory \ | |
| --threshold-test t_test \ | |
| --threshold-max-sample-size 64 \ | |
| --threshold-upper-boundary 0.99 \ | |
| --thresholds-reset \ | |
| --err \ | |
| --adapter json \ | |
| --github-actions '${{ secrets.GITHUB_TOKEN }}' \ | |
| --ci-number "$PR_NUMBER" \ | |
| --file "$BENCHMARK_RESULTS" |