ci: publish benchmarks to GH pages#125
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the benchmarks GitHub Actions workflow to persist and publish benchmark results (intended for GitHub Pages/gh-pages) instead of only printing them in the step summary.
Changes:
- Elevates workflow token permissions to allow writing repository contents (and deployments).
- Adds
benchmark-action/github-action-benchmarkto store Go benchmark results under a per-arch directory. - Adds a manual
git pushstep intended to publish results to thegh-pagesbranch.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| permissions: | ||
| contents: read | ||
| contents: write | ||
| deployments: write |
There was a problem hiding this comment.
deployments: write permission is granted but nothing in this workflow uses the Deployments API (only contents is needed for pushing to a branch). Please remove this permission to follow least-privilege and reduce token scope.
| deployments: write |
.github/workflows/benchmarks.yml
Outdated
| name: 'Nerdbox Benchmarks' | ||
| tool: 'go' | ||
| benchmark-data-dir-path: "data/benchmarks/linux/${{ matrix.arch }}" | ||
| output-file-path: 'benchmark.json' |
There was a problem hiding this comment.
output-file-path is set to benchmark.json, but this workflow only creates /tmp/bench-output.txt from the go test run. github-action-benchmark will fail (or parse nothing) unless the path points to an existing benchmark output file. Point output-file-path at the file you generate (e.g., /tmp/bench-output.txt), or add a step that actually produces benchmark.json in the expected format.
| output-file-path: 'benchmark.json' | |
| output-file-path: '/tmp/bench-output.txt' |
|
|
||
| - name: Push benchmark result | ||
| run: git push 'https://github.com/containerd/nerdbox.git' ghpages:gh-pages |
There was a problem hiding this comment.
This push command is very likely to fail: (1) ghpages is not a ref created anywhere in this job, so git push … ghpages:gh-pages will error unless that branch exists locally; and (2) pushing to a raw https://github.com/... remote won’t use the actions/checkout injected credentials, so it will be unauthenticated. Prefer pushing to origin (with checkout credentials) and push the ref that actually exists (e.g., git push origin HEAD:gh-pages), or enable the benchmark action’s built-in push/gh-pages options and drop the manual git push step.
| - name: Push benchmark result | |
| run: git push 'https://github.com/containerd/nerdbox.git' ghpages:gh-pages | |
| auto-push: true | |
| gh-pages-branch: gh-pages |
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
8786def to
eb6cab6
Compare
No description provided.