Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/java-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- run: ./gradlew check
- uses: actions/upload-artifact@v2
if: failure()
with:
name: test logs
path: |
**/build/testlogs
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we just need to archive **/build/reports. The reports have the full stack traces and usually have any stderr/stdout for each test. That may be easier than creating a separate file since I think we already aggregate the logs there.


17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ subprojects {
}

test {
def logDir = "${rootDir}/build/testlogs"
def logFile = "${logDir}/${project.name}.log"
mkdir("${logDir}")
delete("${logFile}")
def buildLog = new File(logFile)
addTestOutputListener(new TestOutputListener() {
def lastDescriptor
@Override
void onOutput(TestDescriptor testDescriptor, TestOutputEvent testOutputEvent) {
if (lastDescriptor != testDescriptor) {
buildLog << "--------\n- Test log for: "<< testDescriptor << "\n--------\n"
lastDescriptor = testDescriptor
}
buildLog << testOutputEvent.destination << " " << testOutputEvent.message
}
})

testLogging {
if ("true".equalsIgnoreCase(System.getenv('CI'))) {
events "failed", "passed"
Expand Down