-
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: Trigger workflows based on changed files #2952
Conversation
@@ -11,12 +11,10 @@ on: | |||
branches: [ main ] | |||
paths: |
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.
We need to run benchmarks for changes of test files. The main reasons are: (1) when making changes to a test in a PR, we need to know that the new test is not too slow. (2) when merging the changes into the main branch, benchmarks need to be triggered to update the performance baseline. Otherwise, when benchmarks are triggered in a new PR, we will be surprised to see that the test has a performance change even though the changes in the PR is irrelevant to the test.
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.
Yes, #2945 was a good example of this where we only modified the test files, and that caused a change in performance. But this is a bit of a rare case though. Maybe we only need to run the benchmark on merge into main, but not in the Pull Request itself? I.e. delete L14 but keep L19?
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.
Maybe we only need to run the benchmark on merge into main, but not in the Pull Request itself?
Or just disable the workflow in PR (i.e. remove lines 16-20) and run it via slash command when necessary?
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.
Or just disable the workflow in PR (i.e. remove lines 16-20) and run it via slash command when necessary?
Yeah, let's go with that. Just keep a commented line like # pull_request:
, so we can manually trigger the benchmark workflow if needed. The slash command can be done in a separate PR.
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.
Done in b1e5fa8.
@@ -17,8 +17,14 @@ name: Publish to PyPI | |||
# Only run for pushes to the main branch and releases. | |||
on: | |||
push: | |||
branches: | |||
- main | |||
branches: [ main ] |
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.
Only publish a test release to TestPyPI if there are code changes.
@@ -11,12 +11,10 @@ on: | |||
branches: [ main ] | |||
paths: |
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.
Yes, #2945 was a good example of this where we only modified the test files, and that caused a change in performance. But this is a bit of a rare case though. Maybe we only need to run the benchmark on merge into main, but not in the Pull Request itself? I.e. delete L14 but keep L19?
- 'Makefile' | ||
- 'MANIFEST.in' | ||
- 'pyproject.toml' | ||
- 'README.rst' |
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.
Reminder to change this to 'README.md' once #2928 is done.
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.
Just a couple more suggestions, and should be ok to merge after handling https://github.com/GenericMappingTools/pygmt/pull/2952/files#r1443654304.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Some workflow runs are unnecessary and waste CI resources. For example, PR #2950 contains no codes or docs changes, but when it was merged into the main branch, workflows "Tests" and "Docs" were still triggered (see https://github.com/GenericMappingTools/pygmt/actions?query=branch%3Amain).
This PR updates the workflow trigger conditions based on changes files, to save CI resources.