CI: Run benchmarks if PR is labeled with "run/benchmark"#2958
Conversation
|
/bechmark |
|
The slash command won't work until the PR is merged into main branch. |
Actually, will CodSpeed be able to link the benchmark report to the PR branch if we trigger it via |
That's a good question. I guess the answer is no. |
How about we set up the workflow to run only when there's a |
Sounds a clever solution. |
|
The benchmark workflow is trigged by the "run-benchmark" label, see https://github.com/GenericMappingTools/pygmt/actions/runs/7431110786?pr=2958. |
|
I feel triggering a workflow based on the PR label is much better than the slash commands. Some thoughts:
|
|
Hmm, the workflow is canceled because I added the 'maintenance' label. |
Yeah, I was thinking of using it for
Sounds good. |
.github/workflows/benchmarks.yml
Outdated
| benchmarks: | ||
| runs-on: ubuntu-22.04 | ||
| if: github.repository == 'GenericMappingTools/pygmt' | ||
| if: github.repository == 'GenericMappingTools/pygmt' && contains(github.event.pull_request.labels.*.name, 'run/benchmark') |
There was a problem hiding this comment.
Actually I'm unsure if the workflow will run in the main branch, because it's a push event not a pull_request event.
There was a problem hiding this comment.
Tried in my own fork. It doesn't work in the main branch.
There was a problem hiding this comment.
Changed the if condition to:
if: github.repository == 'GenericMappingTools/pygmt' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/benchmark'))
Now it works in my own fork, see the changes between my fork and the pygmt repository: main...seisman:pygmt:main and the workflow was triggered when pushing in the main branch (https://github.com/seisman/pygmt/actions/workflows/benchmarks.yml).
|
It's unclear why I can't see the flame graphs. |
weiji14
left a comment
There was a problem hiding this comment.
It's unclear why I can't see the flame graphs.
Hmm yeah, are you getting this Execution profile not available message too at https://codspeed.io/GenericMappingTools/pygmt/branches/slash-benchmark?
If I try another branch (e.g. https://codspeed.io/GenericMappingTools/pygmt/branches/alias/function), it looks ok, though sometimes the flame graphs can take some time to render.
| - '.github/workflows/benchmarks.yml' | ||
| # Uncomment the 'pull_request' line below to trigger the workflow in PR | ||
| # pull_request: | ||
| # Run in PRs but only if the PR has the 'run/benchmark' label |
There was a problem hiding this comment.
Should we document in .github/PULL_REQUEST_TEMPLATE.md or somewhere for contributors to request that the run/benchmark label gets added to PRs that might affect performance? Or just rely on the maintainers to set the label for now?
There was a problem hiding this comment.
I prefer to leave the jobs to the maintainers. We probably will document it in the contributors guides when addressing #1113.
There was a problem hiding this comment.
Ok, or we can put it in doc/maintenance.md somewhere. Not urgent though, since we aren't running the benchmarks that often.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
|
Quick question: Do we want to remove the |
|
I'm OK with either. Maybe we should keep the label so that we know which branches have performance reports. |
Actually, we should remove the 'run/benchmark' label. We usually label a PR as "needs-review", then "final-review-call" and remove the "final-review-call" label before merging. All these actions will trigger the benchmarks workflow if the |
Owh, but we would need to remove all those labels at the same time right? Maybe better to set an if-condition so that the benchmark workflow is not re-triggered after a PR is already merged? |
We need to remove
It may make the |
Ok, let's go with this. Remove the |
…)" This reverts commit ecefd53.

Support running benchmarks in PRs with the
run/benchmarklabel.Address comment #2952 (comment).