Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

[RFR] Print test failures in GH Actions #765

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

jtotoole
Copy link
Contributor

@jtotoole jtotoole commented Feb 4, 2021

No description provided.

@jtotoole jtotoole marked this pull request as draft February 4, 2021 00:19
@pypt
Copy link
Contributor

pypt commented Feb 8, 2021

Is this PR (or the other one with a similar name) something to look at already, or is it still work in progress?

@jtotoole
Copy link
Contributor Author

jtotoole commented Feb 8, 2021

Not ready for prime time yet; I'm facing a stumbling block that I figured we could discuss in more detail tomorrow. Specifically, the awk command I added as a new build step to print just the test failures seems unable to interact properly with joblog.txt.:

Screen Shot 2021-02-08 at 10 58 23 AM

The GH Actions logs have nothing to say on the subject, so I'm at a loss.

Closed the other PR related to this as I think the approach here is more likely to be useful.

@pypt
Copy link
Contributor

pypt commented Feb 8, 2021

I think GHA doesn't run step n+1 if step n has failed, so you might want to either make the "Run tests" step exit with a zero error code, merge the "Run tests" and "Print test failures" into a single step, or (perhaps better approach) add some conditionals.

Also, running the full test suite takes a whole lot of time so you might consider temporarily removing a bunch of tests from the codebase just to make the GHA run finish faster. Later you can just git revert the commit.

@jtotoole
Copy link
Contributor Author

jtotoole commented Mar 8, 2021

Finally got this working as intended—see the "List errors and test failures" step in this build

@jtotoole jtotoole marked this pull request as ready for review March 8, 2021 18:03
@jtotoole jtotoole changed the title [WIP] Print test failures in GH Actions Print test failures in GH Actions Mar 8, 2021
@jtotoole jtotoole requested a review from pypt March 8, 2021 18:03
@jtotoole
Copy link
Contributor Author

ready for review!

@pypt
Copy link
Contributor

pypt commented Jul 2, 2021

Merged in master to trigger a rebuild (the old one has expired).

@pypt
Copy link
Contributor

pypt commented Jul 2, 2021

So printing failures as GitHub Actions annotations didn't work?

@jtotoole
Copy link
Contributor Author

jtotoole commented Jul 2, 2021

I initially abandoned that approach because the GitHub Checks API will only publish annotations on test files that have been changed in the PR. There's a marketplace action that will annotate everywhere if we first create a test summary file in JUnit XML format, but that seemed like rather high-hanging fruit compared to this approach. That said, I'm happy to give the JUnit thing a shot if you think it'd be better and not wildly complicated.

@jtotoole jtotoole changed the title Print test failures in GH Actions [RFR] Print test failures in GH Actions Jul 6, 2021
Copy link
Contributor

@pypt pypt left a comment

Choose a reason for hiding this comment

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

A single question, plus I don't think the build works anymore.

@@ -189,3 +189,7 @@ jobs:
MC_TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.MC_TWITTER_ACCESS_TOKEN_SECRET }}
MC_TWITTER_CONSUMER_KEY: ${{ secrets.MC_TWITTER_CONSUMER_KEY }}
MC_TWITTER_CONSUMER_SECRET: ${{ secrets.MC_TWITTER_CONSUMER_SECRET }}

- name: List test failures and errors
run: echo -e 'Test failures:\n' && awk '/FAILURES/,/short/' /home/runner/runners/*/_diag/pages/*.log && echo -e '\n\nErrors:\n' && awk '/non-zero/,/status 1/' /home/runner/runners/*/_diag/pages/*.log
Copy link
Contributor

Choose a reason for hiding this comment

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

What's in /home/runner/runners/*/_diag/pages/*.log, i.e. how are you finding those errors? Do you perhaps have a sample log file from that directory that we could look at (without various private credentials that might be in this log)?

Grepping (awking?) out failures from a log file is a bit wonky because any test might print a string FAILURES at any point for a legitimate reason and still succeed; plus, tests don't have to fail with status 1 specifically as they can have any non-zero exit status.

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

Successfully merging this pull request may close these issues.

None yet

2 participants