Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Apr 29, 2024
1 parent 6f1215c commit 2dbdcf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
18 changes: 4 additions & 14 deletions .github/actions/test-summary/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,18 @@ runs:
testReportHeading = testReportHeading.replace(/-/g, ' ').replace(/(^\w{1})|(\s+\w{1})/g, wordFirstLetter => wordFirstLetter.toUpperCase());
}
console.log("====> testReportGlobPattern " + testReportGlobPattern);
// Iterate and parse surefire / failsafe reports and use the info to build the summary
const globber = await glob.create(testReportGlobPattern);
for await (const reportFile of globber.globGenerator()) {
console.log("====> reportFile " + reportFile);
const file = fs.readFileSync(reportFile);
const report = junit.parse(file).then((report) => {
console.log("====> report.errors " + report.errors);
console.log("====> report.failures " + report.failures);
if (report.errors > 0 || report.failures > 0) {
report.testcase.forEach((testCase) => {
console.log("====> testCase.failure " + testCase.failure);
if (testCase.failure !== undefined) {
console.log("====> testCase.classname " + testCase.classname);
console.log("====> testCase.name " + testCase.name);
const shortClassName = `<code>testCase.classname.substring(testCase.classname.lastIndexOf('.') + 1)</code>`;
const className = `<details><summary>view</summary>\n${testCase.classname}</details>`;
const details = `<details><summary>${shortClassName}</summary>\n<code>${testCase.failure[0].inner}</code></details>`;
let testName = `<code><${testCase.name}</code>`
const shortClassName = `<code>${testCase.classname.substring(testCase.classname.lastIndexOf('.') + 1)}</code>`;
const className = `<details><summary>${shortClassName}</summary>\n${testCase.classname}</details>`;
const details = `<details><summary>View</summary>\n<code>${testCase.failure[0].inner}</code></details>`;
let testName = `<code><${testCase.name}</code>`;
if (testName.length > 25) {
testName = `<details><summary>View</summary>\n<code><${testCase.name}</code></details>`;
}
Expand All @@ -74,10 +66,8 @@ runs:
});
}
console.log("====> summaryData.length " + summaryData.length);
// Write the summary data if there were test failures
if (summaryData.length > 1) {
console.log(summaryData);
await core.summary
.addHeading(testReportHeading)
.addTable(summaryData)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ jobs:
if: ${{ failure() }}
with:
test-report-xml-base-dir: integration-tests
test-report-summary-heading: Integration Tests Alternative JDK ${{ matirx.name }}
test-report-summary-heading: Integration Tests Alternative JDK ${{matirx.name}}

integration-tests-alternative-platform:
runs-on: ${{ matrix.os }}
Expand Down

0 comments on commit 2dbdcf4

Please sign in to comment.