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

Replace test-summary action with custom action code #3119

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
20 changes: 0 additions & 20 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,6 @@ jobs:
test-reports/fdb-relational-jdbc/
test-reports/fdb-relational-server/
test-reports/yaml-tests/
- name: Test Summary
if: always()
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
paths: |
fdb-java-annotations/.out/test-results/**/TEST-*.xml
fdb-extensions/.out/test-results/**/TEST-*.xml
fdb-record-layer-core/.out/test-results/**/TEST-*.xml
fdb-record-layer-icu/.out/test-results/**/TEST-*.xml
fdb-record-layer-spatial/.out/test-results/**/TEST-*.xml
fdb-record-layer-lucene/.out/test-results/**/TEST-*.xml
fdb-record-layer-jmh/.out/test-results/**/TEST-*.xml
examples/.out/test-results/**/TEST-*.xml
fdb-relational-api/.out/test-results/**/TEST-*.xml
fdb-relational-core/.out/test-results/**/TEST-*.xml
fdb-relational-cli/.out/test-results/**/TEST-*.xml
fdb-relational-grpc/.out/test-results/**/TEST-*.xml
fdb-relational-jdbc/.out/test-results/**/TEST-*.xml
fdb-relational-server/.out/test-results/**/TEST-*.xml
yaml-tests/.out/test-results/**/TEST-*.xml
- name: Test Coverage Comment
uses: madrapps/jacoco-report@7c362aca34caf958e7b1c03464bd8781db9f8da7
with:
Expand Down
8 changes: 8 additions & 0 deletions actions/gradle-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ runs:
uses: ./actions/run-gradle
with:
gradle_command: build destructiveTest -PcoreNotStrict ${{ inputs.gradle_args }}
- name: Test Summary
shell: bash
if: ${{ !cancelled() && hashFiles('.out/reports/test-summary.md') != '' }}
run: cat .out/reports/test-summary.md > $GITHUB_STEP_SUMMARY
- name: Test Failures
shell: bash
if: ${{ !cancelled() && hashFiles('.out/reports/test-failures.md') != '' }}
run: cat .out/reports/test-failures.md > $GITHUB_STEP_SUMMARY
- name: Copy Test Reports
shell: bash
if: always()
Expand Down
34 changes: 34 additions & 0 deletions gradle/testing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,47 @@ tasks.withType(Test) { theTask ->
events 'failed'
exceptionFormat = 'full'
}
// This creates two reports to be picked up by the gradle actions (see actions/gradle-test/action.yml)
// We initialize the files here, to be filled out by test listeners below
// summary has a summary of all the test tasks we ran, and the success/skipped/failure counts & duration
// failures includes any failures that happened, with the stack trace
def markdownReports = new File("$rootDir/.out/reports/")
def summary = new File(markdownReports, "test-summary.md")
def failures = new File(markdownReports, "test-failures.md")
doFirst {
// This may have issues with running tasks concurrently
if (!markdownReports.exists()) {
markdownReports.mkdirs()
}
if (!summary.exists()) {
summary.append("|Test run|❌|⚠️|✅|time|\n")
summary.append("|-|-|-|-|-|\n")
}
}

beforeTest { descriptor ->
println "${Instant.now()} ${getFullDisplayName(descriptor)} STARTED"
}
afterTest { descriptor, result ->
def duration = String.format(Locale.ROOT, "%,d", result.endTime - result.startTime)
println "${Instant.now()} ${getFullDisplayName(descriptor)} ${result.resultType} (${duration}ms)"
println()
if (result.resultType == TestResult.ResultType.FAILURE) {
failures.append(
"<details>\n" +
"<summary> ❌ ${getFullDisplayName(descriptor)}</summary>\n" +
"(${duration}ms)\n\n" + // blank line is required for ``` to work
"```\n${result.getException().asString()}\n```\n" +
"</details>\n")
}
}
afterSuite { descriptor, result ->
if (descriptor.parent == null) {
def duration = String.format(Locale.ROOT, "%,d", result.endTime - result.startTime)
def description = descriptor.toString().replaceFirst("Gradle Test Run ", "")
summary.append(
"|${description}|${result.getFailedTestCount()}|${result.getSkippedTestCount()}|${result.getSuccessfulTestCount()}|${duration}ms|\n")
}
}
reports {
junitXml.outputPerTestCase = true
Expand Down
Loading