Skip to content
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

[TEST] skipping GA checks with labels #1498

Draft
wants to merge 113 commits into
base: main
Choose a base branch
from

Conversation

rocco8773
Copy link
Member

@rocco8773 rocco8773 commented Mar 24, 2022

This PR puts a framework into the CI Test workflow that allows parts of the tests to be skipped based on labels added to the PR.

The motivation for this prototype came about when the GA Documentation Test was failing due to a recent release of jinja2 and not related to what the contributor was doing. In this scenario we were completely block from merging the PR until the test was resolved, luckily in that case it was an easy fix.

Another upside to this approach, we can turn off comprehensive tests until we reach the end of a PR development. This should allows to both expand PR tests while not overloading our resources.

I did build a job into the workflow that does fail if other jobs are skipped, unless the "GA Skip Merge Allowed" label is added to the PR. This should add some redundancy against us unintentionally merging a PR with skipped tests.

@rocco8773 rocco8773 marked this pull request as ready for review March 24, 2022 20:14
@rocco8773 rocco8773 marked this pull request as draft March 24, 2022 20:14
@github-actions github-actions bot added the CI Related to continuous integration label Mar 24, 2022
@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #1498 (466afc2) into main (08d9eea) will not change coverage.
The diff coverage is n/a.

❗ Current head 466afc2 differs from pull request most recent head a28abb3. Consider uploading reports for the commit a28abb3 to get more accurate results

@@           Coverage Diff           @@
##             main    #1498   +/-   ##
=======================================
  Coverage   97.06%   97.06%           
=======================================
  Files          82       82           
  Lines        7739     7739           
=======================================
  Hits         7512     7512           
  Misses        227      227           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08d9eea...a28abb3. Read the comment docs.

@rocco8773
Copy link
Member Author

@namurphy @StanczakDominik I'm curious what both of your takes are on this setup. I have my own takes on it, but I want to hear yours before I give my thoughts.

@rocco8773
Copy link
Member Author

Oh, and feel free to play with the labels to see how they work.

@StanczakDominik
Copy link
Member

I was briefly confused about what checks are running for General Atomics... I'll give this a look through today.

Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall idea looks great! A couple questions for the implementation, and I think we could also give the labels descriptions in https://github.com/PlasmaPy/PlasmaPy/labels.

Comment on lines +38 to +41
SKIP_DOCUMENTATION: ${{ env.SKIP_DOCUMENTATION }}
SKIP_COMPREHENSIVE: ${{ env.SKIP_COMPREHENSIVE }}
SKIPS_ALLOWED: ${{ env.SKIPS_ALLOWED }}
SKIPS_DONE: ${{ env.SKIPS_DONE }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if I understand it correctly, this skips-allowed job does the logic, puts the result into env vars, and this outputs field, which I'm seeing for the first time, lets you pass those env vars to the next stage. That's reasonable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. I originally tries this by defining env on the workflow level, but it turns out the workflow level env just acts as an initialization for the job level env. So, if I modify an environment variable in job1 then that doesn't carry over to job2. The only way I've found that I can pass this information between jobs is using outputs for the job.

.github/workflows/testing.yml Show resolved Hide resolved
run: |
echo "Is skipping tests allowed: ${{ env.SKIPS_ALLOWED }}"
if [[ "$SKIPS_ALLOWED" == "false" && "$SKIPS_DONE" == "true" ]]; then
echo "Some tests are skipped, but skipping needs to be removed before merging!!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to make this message more actionable by doing something like this:

Suggested change
echo "Some tests are skipped, but skipping needs to be removed before merging!!"
echo "Some tests are skipped - either unskip them before merging or add $SKIPS_ALLOWED_LABEL if you're willing to live with the consequences!!"

but I expect it won't work because SKIPS_ALLOWED_LABEL is "scoped" locally in another job... right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would work. I originally didn't write something like this because I only wanted us to know about the "skips allows" functionality. Only we should be adding that label and not the common contributor.

Comment on lines +123 to +124
if: ${{ needs.skips-allowed.outputs.SKIP_COMPREHENSIVE == 'false' }}
needs: [initial-tests, skips-allowed]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if SKIP_COMPREHENSIVE is false, this needs both of these... oh, no, right, this runs conditionally only if that var is false, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

@@ -101,6 +176,8 @@ jobs:
with:
file: ./coverage.xml
documentation:
if: ${{ needs.skips-allowed.outputs.SKIP_DOCUMENTATION == 'false' }}
needs: skips-allowed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I don't understand is... does this only run if you're enabling skips-allowed via GA Skip Merge Allowed? Suppose I don't skip anything, does this still run?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skips-allowed job always runs regardless of labeling, and will never fail. I breakout that "merge-able failure" into a separate job since if it fails any dependent jobs would automatically skip.

Since the outputs are defined using the job's env, the outputs are automatically initialized with the env values.

@github-actions
Copy link

This pull request will be closed in 14 days due to a year of inactivity unless the stale label or comment is removed.

@github-actions github-actions bot added the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label May 13, 2023
@namurphy namurphy added the status: dormant PRs that are stalled label May 26, 2023
@github-actions github-actions bot removed the Stale Dormant issues & PRs which will be automatically closed if the label is not removed. label Sep 9, 2023
@namurphy namurphy added this to the Future milestone Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Related to continuous integration GA Skip Comprehensive Tests GA Skip Merge Allowed status: dormant PRs that are stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants