Avoid test output from being cached

Thanks, including the test results in the cache does actually make sense, though works against my use case.

I discovered a solution for my workflow. If I disable the HTML and XML reports in my job that populates the cache, it will prevent them from being restored in my PR jobs. Then in the PR job, I would let the reports be enabled. This would result in only XML reports for the tests were actually run in the job.

Here’s the relevant snippet

userDisableJUnitReports = project.hasProperty('disableJUnitReports') && disableJUnitReports.toBoolean()

test {
    // ... other test configs
    reports {
        junitXml.required = !userDisableJUnitReports
        html.required = !userDisableJUnitReports
    }
}

Edit: marking this as Solution since it answers my original question

1 Like