Skip to content

Commit

Permalink
Polish test matrix and disable older JDKs for Gradle 8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Aug 15, 2024
1 parent bf83155 commit 629f1f7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
# Test on all LTS JDKs and the latest JDK.
jdk: [ 8, 11, 17, 21, 22 ]
runs-on: ${{ matrix.os }}
steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,30 @@ tasks.test {
onlyIf { false }
}

val allGradle = listOf("6.6", "7.3", "7.6", GradleVersion.current().version)
// Test on older Gradle and the latest one.
val allGradle = listOf(
GradleVersion.version("6.6"),
GradleVersion.version("7.3"),
GradleVersion.version("7.6"),
GradleVersion.current(),
)
// Configure various JDKs on CI.
val testJdk = providers.gradleProperty("me.champeau.japicmp.javaToolchain.test")
.getOrElse("8").toInt()

// https://docs.gradle.org/current/userguide/compatibility.html
allGradle.forEach { gradleVersion ->
if (gradleVersion < "7.3" && testJdk >= 17) return@forEach
if (gradleVersion < "8.5" && testJdk >= 21) return@forEach
if (gradleVersion < "8.8" && testJdk >= 22) return@forEach
allGradle.forEach { gv ->
// Gradle 7.3+ supports Java 17.
if (gv < GradleVersion.version("7.3") && testJdk >= 17) return@forEach
// Gradle 8.5+ supports Java 21.
if (gv < GradleVersion.version("8.5") && testJdk >= 21) return@forEach
// Gradle 8.8+ supports Java 22.
if (gv < GradleVersion.version("8.8") && testJdk >= 22) return@forEach
// Executing Gradle on JVM versions 16 and lower has been deprecated. Use JVM 17 or greater to execute Gradle.
// See https://docs.gradle.org/8.10/userguide/upgrading_version_8.html#minimum_daemon_jvm_version.
if (gv >= GradleVersion.version("8.10") && testJdk < 17) return@forEach

val gradleVersion = gv.version

val task = tasks.register<Test>("testJdk${testJdk}onGradle${gradleVersion}") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
Expand Down

0 comments on commit 629f1f7

Please sign in to comment.