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

fix: collect all test reports #1030

Merged
merged 3 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 21 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,26 @@ repositories {

apply plugin: 'nebula-aggregate-javadocs'

// a task to run all tests and combine them in one report
task testReport(type: TestReport) {
print("System.getenv(\"CI\"): " + System.getenv("CI"))
print(" - System.getenv(\"versionTag\"): " + System.getenv("versionTag"))
// A resolvable configuration to collect test reports data
configurations {
testReportData {
canBeResolved = true
canBeConsumed = false
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'test-report-data'))
}
}
}

dependencies {
testReportData project('main')
testReportData project(':processor')
testReportData project(':core')
}

tasks.register('testReport', TestReport) {
destinationDir = file("$buildDir/reports/allTests")
// Combine all 'test' task results into a single HTML report
reportOn subprojects.collect { it.tasks.withType(Test) }
// Use test results from testReportData configuration
testResultDirs.from(configurations.testReportData)
}
13 changes: 13 additions & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,16 @@ compileJava {
compileTestJava {
options.compilerArgs << '-parameters'
}

// Share the test report data to be aggregated for the whole project
configurations {
binaryTestResultsElements {
canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'test-report-data'))
}
outgoing.artifact(test.binaryResultsDirectory)
}
}
12 changes: 12 additions & 0 deletions main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,15 @@ test {
}
}

// Share the test report data to be aggregated for the whole project
configurations {
binaryTestResultsElements {
canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'test-report-data'))
}
outgoing.artifact(test.binaryResultsDirectory)
}
}
13 changes: 13 additions & 0 deletions processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@ test {
events "passed", "skipped", "failed"
}
}

// Share the test report data to be aggregated for the whole project
configurations {
binaryTestResultsElements {
canBeResolved = false
canBeConsumed = true
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'test-report-data'))
}
outgoing.artifact(test.binaryResultsDirectory)
}
}