-
Notifications
You must be signed in to change notification settings - Fork 107
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
Migrate unit and integration tests from TravisCI to GitHub Actions #580
Conversation
👈 Launch a binder notebook on this branch for commit 69dcec3 I will automatically update this comment whenever this PR is modified 👈 Launch a binder notebook on this branch for commit b98483c 👈 Launch a binder notebook on this branch for commit cd2f771 👈 Launch a binder notebook on this branch for commit 8ebabce 👈 Launch a binder notebook on this branch for commit e5b2610 👈 Launch a binder notebook on this branch for commit 7aab5bb 👈 Launch a binder notebook on this branch for commit 434b010 👈 Launch a binder notebook on this branch for commit 0038615 👈 Launch a binder notebook on this branch for commit a5b2609 👈 Launch a binder notebook on this branch for commit 2426af3 👈 Launch a binder notebook on this branch for commit 33592a5 👈 Launch a binder notebook on this branch for commit 0daf7ae 👈 Launch a binder notebook on this branch for commit 88bc5d9 👈 Launch a binder notebook on this branch for commit 39006bd 👈 Launch a binder notebook on this branch for commit 098bb98 👈 Launch a binder notebook on this branch for commit 417238f 👈 Launch a binder notebook on this branch for commit a950c87 👈 Launch a binder notebook on this branch for commit 7bb6cb5 👈 Launch a binder notebook on this branch for commit 3115443 👈 Launch a binder notebook on this branch for commit 0b82f05 👈 Launch a binder notebook on this branch for commit 4183ece 👈 Launch a binder notebook on this branch for commit 4e59c92 👈 Launch a binder notebook on this branch for commit 403643b 👈 Launch a binder notebook on this branch for commit 8ee626a |
I got a bit frustrated trying to get the integration test "secure approval" process working the way I want it to. The event isn't triggering, and I don't know how (of if it's possible) to debug that. I'm going to spend some time on the Harmony -> ECS work today to give myself a break. I made a post in Openscapes Slack asking if anyone has ideas what's going wrong in the meantime :) Any tips greatly appreciated! |
I think I'm going to split this PR into two pieces: (1) migrate Travis -> GHA as-is; (2) the approval thing. (1) alone provides value by reducing the number of unique automation systems we depend on. |
434b010
to
0038615
Compare
push: | ||
branches: | ||
- "main" | ||
- "development" |
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.
Given these are slightly "expensive" tests since they download files (and running them for every commit could ultimately influence the icepyx metrics), what are our options for restricting how often they run for a given 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.
These triggers (branches:
) would be for every merge, not for every commit on PRs. We can customize the pull_request:
triggers. By default, they run on open
and synchronize
(effectively, when the PR is pushed to, not on every commit). The full list is here: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request
I think the best way we can limit these runs is by adding paths:
filters. That would enable e.g. docs changes to not trigger the expensive tests!
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 consider this part of this PR, or create an issue to track the work?
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.
(effectively, when the PR is pushed to, not on every commit).
Right - forgot this subtlety - but a PR can have a lot of pushes too!
Should we consider this part of this PR, or create an issue to track the work?
I would definitely consider it part of this PR. I don't want to have a setup running that will trigger so many runs.
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 would definitely consider it part of this PR. I don't want to have a setup running that will trigger so many runs.
Don't want to push back too hard, because I am fine doing it however, but I do want to raise that Travis CI behaves this way already:
https://github.com/icesat2py/icepyx/blob/development/.travis.yml#L21-L24
I would lean towards breaking this work into two PRs: (1) migrate Travis -> GH; (2) more efficient. When those PRs are merged into development
, they will produce two clearer commits and entries in the changelog. I'm OK with immediately following this PR up with step 2 if you're OK with dividing it!
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 "approved"? I think this is how I set up the uml diagram action so it only runs once per PR.
There is no approved event type. That workflow checks the current state of the PR after triggering the workflow, and if it's not "approved", it sets the workflow to "skipped":
icepyx/.github/workflows/uml_action.yml
Line 10 in a52bc37
if: github.event.review.state == 'approved' |
If there was an approved event type, then we could avoid the triggering in the first place :(
Since we have other possible triggers we would need something like ${{ github.event.action != "pull_request_review" || github.event.review.state == "approved" }}
. Otherwise, integration tests would be skipped on our release PRs until they were approved, and if we want that behavior we can remove the pull_request
trigger. Thoughts?
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.
There is no approved event type.
Guess that was wishful thinking on my part then.
Since we have other possible triggers we would need something like ${{ github.event.action != "pull_request_review" || github.event.review.state == "approved" }}. Otherwise, integration tests would be skipped on our release PRs until they were approved, and if we want that behavior we can remove the pull_request trigger. Thoughts?
I'm happy with the latest edits versus this. I don't think we tend to have a lot of official "reviews" until we're getting pretty close to merging, and it would be great to have the tests run on release PRs right away.
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'm happy with the latest edits versus this. I don't think we tend to have a lot of official "reviews" until we're getting pretty close to merging, and it would be great to have the tests run on release PRs right away.
I might need to rescind this. I'm noticing the integration test is running, which makes me think that GH considers a comment (regardless of approval) to be a "review", thus triggering the action for any comment made on the 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.
I'm thinking the least unpalatable option at this point is your suggestion to remove the PR trigger and add something like ${{ github.event.action != "pull_request_review" || github.event.review.state == "approved" }}
.
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.
Let's try it on for size!
Co-authored-by: Jessica Scheick <[email protected]>
Co-authored-by: Jessica Scheick <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## development #580 +/- ##
===============================================
+ Coverage 65.36% 65.45% +0.09%
===============================================
Files 36 36
Lines 3037 3037
Branches 531 594 +63
===============================================
+ Hits 1985 1988 +3
+ Misses 970 964 -6
- Partials 82 85 +3 ☔ View full report in Codecov by Sentry. |
Is it possible that it's because the action isn't yet in development? |
Co-authored-by: Jessica Scheick <[email protected]>
I did run in to that initially. I've been testing on my fork, and I did merge into |
@JessicaS11 I stealth-edited some TODOs in the description of this PR. Just realized Travis will block merge if it doesn't run :) |
It's provided as a fixture
098bb98
to
417238f
Compare
I was confused why the tests weren't passing, and it turns out they also depend on an envvar named |
Based on feedback: #580 (comment)
Co-authored-by: Jessica Scheick <[email protected]>
for more information, see https://pre-commit.ci
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 for all the problem solving and changes on this one! I'm excited to get CI moved onto GH, so thanks for making it happen, Matt.
Any time! 🚀 |
Closes #547
This PR migrates the current TravisCI behavior into GitHub Actions.
New feature: Unit tests run on multiple versions of Python.
TODO:
Note
This does not attempt to implement an approval process for PRs from forks. We don't have that now, so we're not losing anything by dropping Travis in this PR. This is challenging. I'll open another draft PR with that stuff, and we can hopefully figure it out.
See #588