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

Try to get a green checkmark even though an optional job failed #1347

Merged
merged 19 commits into from
Oct 31, 2024

Conversation

wsanchez
Copy link
Member

GHA workflows fail when a job fails.

We use continue-on-error to prevent halting the workflow, and that is good enough for validation prior to merge, it leaves us with a visually annoying red X where we want to see a green checkmark.

What we want is support in GHA for the workflow to ignore specific job failures, but that doesn't exist. (A very popular but unimplemented feature request already exists for this.)

This PR is an attempt at a work-around.

@wsanchez wsanchez added the Task label Oct 30, 2024
@wsanchez wsanchez self-assigned this Oct 30, 2024
@wsanchez
Copy link
Member Author

Emitting a warning adds an annotation to the job, which you might notice (but probably won't) if you look at the job (which you normally wouldn't do). So that's unsatisfying.

@wsanchez
Copy link
Member Author

GITHUB_STEP_SUMMARY output goes into the workflow summary page, but that is not exactly a thing you'd see normally either… not great.

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.97%. Comparing base (758f3a5) to head (fbad1bb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1347      +/-   ##
==========================================
- Coverage   69.00%   68.97%   -0.03%     
==========================================
  Files         181      181              
  Lines        8865     8865              
  Branches     1484     1484              
==========================================
- Hits         6117     6115       -2     
- Misses       2648     2649       +1     
- Partials      100      101       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

⚠️ Optional matrix job Py:3.14.0-alpha.1 - ubuntu-latest failed ⚠️

  • tox prefix: test
  • exit status: 1

@wsanchez
Copy link
Member Author

wsanchez commented Oct 31, 2024

OK this is decent… here we get

  • a green checkmark for the job (not great, but this is the trade-off we are making)
  • a green checkmark for the workflow (the goal here)
  • a comment in the PR indicating that an optional build failed (replacement for red checkmark for the job)
Screenshot 2024-10-31 at 10 42 26 AM

@wsanchez wsanchez merged commit f82715c into master Oct 31, 2024
11 checks passed
@wsanchez wsanchez deleted the green-check branch October 31, 2024 17:49
Comment on lines +240 to +241
status=0
tox run -e "${TOX_ENV}" || status=$?
Copy link

Choose a reason for hiding this comment

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

IIRC $? is a feature of any shell, most likely any shell in Microsoft Github Actions, therefore both lines can be condensed to a single line on the second lines' composition:

tox run -e "${TOX_ENV}"; status=$?

Thanks for posting a useful comment updating the other thread! @wsanchez

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants