diff --git a/.github/workflows/pr_bare_metal_benchmarks.yml b/.github/workflows/pr_bare_metal_benchmarks.yml new file mode 100644 index 0000000..1a81bbe --- /dev/null +++ b/.github/workflows/pr_bare_metal_benchmarks.yml @@ -0,0 +1,32 @@ +on: + pull_request: + types: [opened, reopened, edited, synchronize] + +jobs: + submit_pr_benchmarks: + name: Submit PR Benchmarks to Bencher Bare Metal + # DO NOT REMOVE: For handling Fork PRs see Pull Requests from Forks + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + permissions: + checks: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: bencherdev/bencher@main + - name: Submit PR Benchmarks with Bencher + run: | + bencher run \ + --project example \ + --key '${{ secrets.BENCHER_API_KEY }}' \ + --branch "$GITHUB_HEAD_REF" \ + --start-point "$GITHUB_BASE_REF" \ + --start-point-hash '${{ github.event.pull_request.base.sha }}' \ + --start-point-clone-thresholds \ + --start-point-reset \ + --adapter json \ + --image example:latest \ + --detach \ + --github-actions '${{ secrets.GITHUB_TOKEN }}' \ + --ci-callback-token '${{ secrets.BENCHER_CALLBACK_TOKEN }}' \ + --exec \ + mock diff --git a/README.md b/README.md index 669e476..18a3380 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ The `.github` directory contains example workflows from [how to use Bencher in G - [Track benchmarks](.github/workflows/fork_pr_benchmarks_track.yml) - [Archive branches for closed pull requests from forks](.github/workflows/fork_pr_benchmarks_closed.yml) - Benchmark pull requests on Bare Metal + - [Submit benchmarks as Jobs](.github/workflows/pr_bare_metal_benchmarks.yml) - [Post results of finished Jobs to pull requests](.github/workflows/pr_bare_metal_benchmarks_attach.yml) These examples use the [Bencher CLI GitHub Action](https://github.com/marketplace/actions/bencher-cli). +The bare metal example's benchmark Image is the [Bencher CLI image](https://github.com/bencherdev/bencher/pkgs/container/bencher), whose entrypoint is `bencher` and which has no shell, so its benchmark command is `mock` with `--exec`.