Build on latest Java, test through lowest possible - approach 2#298
Build on latest Java, test through lowest possible - approach 2#298
Conversation
| ./gradlew --version | ||
| ./gradlew --stacktrace build compatTestJava${{ matrix.jdk }} | ||
| ./gradlew -q javaToolchains | ||
| ./gradlew --stacktrace -PnexusPublishPlugin.test.java=${{ matrix.testJdk }} build compatTestJava${{ matrix.jdk }} |
There was a problem hiding this comment.
To avoid "javaauto" in stutter, we could add testJdk matrix elements manually, adjusting "auto" version to a given JDK version.
Also a shell command could replace "auto" with a proper version.
However, I don't know which of this 3 options is best :-/
| jdk: [11, 17] | ||
| name: "OpenJDK ${{ matrix.jdk }}" | ||
| jdk: [11, 17, 19] | ||
| testJdk: [auto, 8] |
There was a problem hiding this comment.
I wonder if we shouldn't have "fail-fast" disabled for that workflow?
| withType<Test>().matching { it.name.startsWith("compatTest") }.configureEach { | ||
| systemProperty("plugin.version", project.version) | ||
| } | ||
| named<Test>("test").configure { |
There was a problem hiding this comment.
This is equivalent:
| named<Test>("test").configure { | |
| test { |
There was a problem hiding this comment.
Is that tasks.test {} or project.test {} just to make sure it's at the right level in the build.gradle.
There was a problem hiding this comment.
tasks.test
It's sitting in the tasks {} block so can reference test directly here.
| // Gradle fully supports running on Java 8: https://docs.gradle.org/current/userguide/compatibility.html, | ||
| // so we should allow users to do that too. | ||
| jvmTarget = JvmTarget.fromTarget(JavaVersion.VERSION_1_8.toString()) | ||
| jvmTarget = JvmTarget.fromTarget(project.java.targetCompatibility.toString()) |
|
I'm yet to do a full review, thanks for looking @3flex ! |
This is a reworked variant of #254 (I really liked the approach with overriding javaLauncher for test @TWiStErRob! - originally I wanted to publish binaries locally and pass it to another jobs, which javaLauncher is much easier) with the following changes:
This is not as reliable as separate e2eTests executed with lower JDK, but the binaries are built with higher JDK and running tests leverages that binaries.
Downsides:
compatTestJavaautoadded)Maybe you will have an idea how to improve it further.