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

Testing JUnit parser for GH Actions #16966

Merged
merged 11 commits into from
Aug 23, 2024
Merged

Testing JUnit parser for GH Actions #16966

merged 11 commits into from
Aug 23, 2024

Conversation

mumrah
Copy link
Contributor

@mumrah mumrah commented Aug 22, 2024

This patch adds a script to parse the JUnit XML files and produce a job summary. The JUnit test reports are also archived by this patch.

@mumrah mumrah requested a review from chia7712 August 22, 2024 21:13
@mumrah
Copy link
Contributor Author

mumrah commented Aug 22, 2024

@chia7712 here is the junit parser PR. It parses all the JUnit reports and gathers the failures and skipped tests. These are printed into a Markdown table that becomes part of the job summary.

https://github.com/apache/kafka/actions/runs/10514796991?pr=16966#summary-29133975884

Screenshot:
image

The script also exits with 1 if any failures are found, which gives us the failing status check in the PR.

Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@mumrah thanks for this patch. it is great already! I leave two "small" comments but please feel free to ignore them because those comments are my personal taste 😄

name: junit-reports-${{ matrix.java }}
path: |
**/test-results/**/*.xml
**/build/reports/tests/test/index.html
Copy link
Contributor

Choose a reason for hiding this comment

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

If we archive only the index.html, developers can't trace the "error stack" from the index.html as the linked class page is nonexistent. Maybe we should cache whole folder of /build/reports/tests/test/ instead of /test-results/**/*.xml?

logger.debug(f"Found skipped test: {skipped_test}")
table.append(("⚠️", simple_class_name, skipped_test.test_name, "Skipped", ""))
duration = pretty_time_duration(total_time)
print(f"{total_tests} tests run in {duration}, {total_failures} failed ❌, {total_skipped} skipped ⚠️, {total_errors} errors.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add the artifact url link? contributors can download the total reports when they check this great summary? the link (actions/upload-artifact#50 (comment)) shows how to get the artifact url and we can pass it through env. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, that seems useful. Especially since we run two tests suites, giving a link to the correct archive is nice.

@mumrah mumrah merged commit be3e674 into apache:trunk Aug 23, 2024
4 of 7 checks passed
LoganZhuZzz pushed a commit to LoganZhuZzz/kafka that referenced this pull request Aug 28, 2024
A few improvements for JUnit in the Actions workflow:

* Generate a human readable job summary of the tests 
* Fail the workflow if JUnit tests fail
* Archive the HTML JUnit reports

Reviewers: Chia-Ping Tsai <[email protected]>
bboyleonp666 pushed a commit to bboyleonp666/kafka that referenced this pull request Sep 4, 2024
A few improvements for JUnit in the Actions workflow:

* Generate a human readable job summary of the tests 
* Fail the workflow if JUnit tests fail
* Archive the HTML JUnit reports

Reviewers: Chia-Ping Tsai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants