Skip to content

Commit c38e707

Browse files
committed
Enable PTS' remaining tests mode and code coverage merging on CI
1 parent 2ee1fcb commit c38e707

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.github/actions/run-gradle/action.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ runs:
2121
run: |
2222
./gradlew \
2323
-Porg.gradle.java.installations.auto-download=false \
24-
-Pjunit.develocity.predictiveTestSelection.enabled=${{ github.event_name == 'pull_request' }} \
24+
-Pjunit.develocity.predictiveTestSelection.enabled=true \
25+
-Pjunit.develocity.predictiveTestSelection.selectRemainingTests=${{ github.event_name != 'pull_request' }} \
2526
"-Dscan.value.GitHub job=${{ github.job }}" \
2627
javaToolchains \
2728
${{ inputs.arguments }}

gradle/plugins/build-parameters/build.gradle.kts

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ buildParameters {
4141
description = "Whether or not to use Predictive Test Selection for selecting tests to execute"
4242
defaultValue = true
4343
}
44+
bool("selectRemainingTests") {
45+
// see https://docs.gradle.com/develocity/predictive-test-selection/#gradle-selection-mode
46+
description = "Whether or not to use PTS' 'remaining tests' selection mode"
47+
defaultValue = false
48+
}
4449
}
4550
group("testDistribution") {
4651
bool("enabled") {

gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal
2+
import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode
23
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
34
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
45
import org.gradle.internal.os.OperatingSystem
@@ -36,9 +37,15 @@ tasks.withType<Test>().configureEach {
3637
predictiveTestSelection {
3738
enabled = buildParameters.junit.develocity.predictiveTestSelection.enabled
3839

40+
if (buildParameters.junit.develocity.predictiveTestSelection.selectRemainingTests) {
41+
mode = PredictiveTestSelectionMode.REMAINING_TESTS
42+
}
43+
3944
// Ensure PTS works when publishing Build Scans to scans.gradle.com
4045
this as PredictiveTestSelectionConfigurationInternal
4146
server = uri("https://ge.junit.org")
47+
48+
mergeCodeCoverage = true
4249
}
4350
}
4451
systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")

0 commit comments

Comments
 (0)