Repository navigation
bencher_run #26
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
| on: | |
| repository_dispatch: | |
| types: [bencher_run] | |
| jobs: | |
| attach_pr_benchmarks: | |
| name: Post PR Benchmark Results from Bencher Bare Metal | |
| permissions: | |
| checks: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Show the type of each dispatch payload field, never its value | |
| run: jq '.client_payload // {} | map_values(if type == "object" then map_values(type) else type end)' "$GITHUB_EVENT_PATH" | |
| - name: Resolve the Bencher CLI commit | |
| id: bencher-cli | |
| run: | | |
| sha="$(git ls-remote https://github.com/bencherdev/bencher refs/heads/u/ep/callback/smoke | cut -f1)" | |
| test -n "$sha" | |
| echo "sha=$sha" >> "$GITHUB_OUTPUT" | |
| echo "key=bencher-cli-$ImageOS-$RUNNER_ARCH-$sha" >> "$GITHUB_OUTPUT" | |
| - name: Restore the Bencher CLI | |
| id: restore-bencher-cli | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ~/.bencher-cli | |
| key: ${{ steps.bencher-cli.outputs.key }} | |
| - name: Install the Bencher CLI | |
| if: steps.restore-bencher-cli.outputs.cache-hit != 'true' | |
| env: | |
| BENCHER_SHA: ${{ steps.bencher-cli.outputs.sha }} | |
| run: cargo install --git https://github.com/bencherdev/bencher --rev "$BENCHER_SHA" --locked --root ~/.bencher-cli bencher_cli | |
| - name: Save the Bencher CLI | |
| if: steps.restore-bencher-cli.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: ~/.bencher-cli | |
| key: ${{ steps.bencher-cli.outputs.key }} | |
| - name: Add the Bencher CLI to the path | |
| run: echo "$HOME/.bencher-cli/bin" >> "$GITHUB_PATH" | |
| - name: Post PR Benchmark Results with Bencher | |
| env: | |
| JOB_UUID: ${{ github.event.client_payload.bencher.job }} | |
| PROJECT_SLUG: ${{ github.event.client_payload.bencher.project }} | |
| run: | | |
| bencher run \ | |
| --host https://dev.api.bencher.dev \ | |
| --project "$PROJECT_SLUG" \ | |
| --token '${{ secrets.DEV_BENCHER_API_TOKEN }}' \ | |
| --job "$JOB_UUID" \ | |
| --error-on-alert \ | |
| --github-actions '${{ secrets.GITHUB_TOKEN }}' |