From cdd6d52642a6d737cb66708fb6619bccdda937cd Mon Sep 17 00:00:00 2001 From: Daniel Chao Date: Wed, 22 Jan 2025 14:08:45 -0800 Subject: [PATCH] Only run Gradle compatibility tests against minimum and maximum release (#898) Currently, we run against every release version, which is taking 20 minutes to run in CI, and this will grow as Gradle creates more releases. This limits the amount of Gradle versions being tested against; theoretically, only testing against the minimum version and the maximum version should ensure that we are compatible with every version in the range. --- .../kotlin/pklGradlePluginTest.gradle.kts | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts b/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts index e939de85..7a06d426 100644 --- a/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts +++ b/buildSrc/src/main/kotlin/pklGradlePluginTest.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. + * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,20 +27,23 @@ tasks.addRule("Pattern: compatibilityTest[All|Releases|Latest|Candidate|Nightly| dependsOn( "compatibilityTestReleases", "compatibilityTestCandidate", - "compatibilityTestNightly" + "compatibilityTestNightly", ) } // releases in configured range "Releases" -> task("compatibilityTestReleases") { val versionInfos = GradleVersionInfo.fetchReleases() - val versionsToTestAgainst = - versionInfos.filter { versionInfo -> - val v = versionInfo.gradleVersion - !versionInfo.broken && - v in gradlePluginTests.minGradleVersion..gradlePluginTests.maxGradleVersion && - v !in gradlePluginTests.skippedGradleVersions - } + val allVersions = + versionInfos + .filter { versionInfo -> + val v = versionInfo.gradleVersion + !versionInfo.broken && + v in gradlePluginTests.minGradleVersion..gradlePluginTests.maxGradleVersion && + v !in gradlePluginTests.skippedGradleVersions + } + .sortedBy { it.gradleVersion } + val versionsToTestAgainst = listOf(allVersions.first(), allVersions.last()) dependsOn(versionsToTestAgainst.map { createCompatibilityTestTask(it) }) } @@ -79,7 +82,7 @@ tasks.addRule("Pattern: compatibilityTest[All|Releases|Latest|Candidate|Nightly| else -> createCompatibilityTestTask( taskNameSuffix, - "https://services.gradle.org/distributions-snapshots/gradle-$taskNameSuffix-bin.zip" + "https://services.gradle.org/distributions-snapshots/gradle-$taskNameSuffix-bin.zip", ) } }