-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
@@ -28,7 +28,7 @@ concurrency: | |||
jobs: | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried in my own fork. It doesn't work in the main branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -12,8 +12,9 @@ on: | |||
paths: | |||
- 'pygmt/**/*.py' | |||
- '.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @seisman! Have secretly wanted this label-based trigger mechanism in PyGMT for a while now to be honest 😀
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/benchmark
label.Address comment #2952 (comment).