-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build on latest Java, test through lowest possible - approach 2 #298
base: master
Are you sure you want to change the base?
Changes from all commits
1650774
97d8f22
6715672
641535f
3a502f1
55b9ebd
a0da4d7
478e1b3
b2dff42
b63ebcb
a358c63
263b035
d4adad6
2aaaf85
6ef36da
48f4085
08bef0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,9 @@ jobs: | |
openjdk: | ||
strategy: | ||
matrix: | ||
jdk: [11, 17] | ||
name: "OpenJDK ${{ matrix.jdk }}" | ||
jdk: [11, 17, 19] | ||
testJdk: [auto, 8] | ||
name: "OpenJDK ${{ matrix.jdk }} (with testJDK ${{ matrix.testJdk }})" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -38,4 +39,5 @@ jobs: | |
- name: Test cross Java versions compatibility | ||
run: | | ||
./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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid "javaauto" in stutter, we could add testJdk matrix elements manually, adjusting "auto" version to a given JDK version. However, I don't know which of this 3 options is best :-/ |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -92,7 +92,7 @@ dependencies { | |||||
testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1") | ||||||
testImplementation("org.assertj:assertj-core:3.25.1") | ||||||
// This cannot be updated to 5.x as it requires Java 11, | ||||||
// but we are running CI on Java 8 in .github/workflows/java-versions.yml. | ||||||
// but we are running tests on CI with Java 8 in .github/workflows/java-versions.yml. | ||||||
testImplementation("org.mockito:mockito-junit-jupiter:4.11.0") | ||||||
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") | ||||||
} | ||||||
|
@@ -129,6 +129,22 @@ stutter { | |||||
compatibleRange("7.3") | ||||||
} | ||||||
} | ||||||
register("java19") { | ||||||
javaToolchain { | ||||||
languageVersion = JavaLanguageVersion.of(19) | ||||||
} | ||||||
gradleVersions { | ||||||
compatibleRange("7.6") | ||||||
} | ||||||
} | ||||||
register("javaauto") { | ||||||
javaToolchain { | ||||||
languageVersion = JavaLanguageVersion.of(JavaVersion.current().majorVersion) | ||||||
} | ||||||
gradleVersions { | ||||||
compatibleRange("7.6") | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -174,7 +190,7 @@ kotlin.target.compilations.configureEach { | |||||
compilerOptions.configure { | ||||||
// 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()) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider merging #300 then rebasing. |
||||||
|
||||||
// Suppress "Language version 1.3 is deprecated and its support will be removed in a future version of Kotlin". | ||||||
freeCompilerArgs.add("-Xsuppress-version-warnings") | ||||||
|
@@ -252,6 +268,17 @@ tasks { | |||||
showStandardStreams = true | ||||||
} | ||||||
} | ||||||
javaLauncher = project.javaToolchains.launcherFor { | ||||||
languageVersion = providers | ||||||
.gradleProperty("nexusPublishPlugin.test.java") | ||||||
.map { | ||||||
if (it == "auto") { | ||||||
JavaLanguageVersion.of(JavaVersion.current().majorVersion) | ||||||
} else { | ||||||
JavaLanguageVersion.of(it) | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
withType<Test>().configureEach { | ||||||
dependsOn(shadowJar) | ||||||
|
@@ -261,6 +288,19 @@ tasks { | |||||
withType<Test>().matching { it.name.startsWith("compatTest") }.configureEach { | ||||||
systemProperty("plugin.version", project.version) | ||||||
} | ||||||
named<Test>("test").configure { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is equivalent:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that |
||||||
javaLauncher = project.javaToolchains.launcherFor { | ||||||
languageVersion = providers | ||||||
.gradleProperty("nexusPublishPlugin.test.java") | ||||||
.map { | ||||||
if (it == "auto") { | ||||||
JavaLanguageVersion.of(JavaVersion.current().majorVersion) | ||||||
} else { | ||||||
JavaLanguageVersion.of(it) | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
publishing { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
org.gradle.caching=true | ||
org.gradle.parallel=true | ||
org.gradle.configuration-cache=true | ||
|
||
# Version of JDK to use for running tests. | ||
# Possible values: | ||
# - auto -> use Java running Gradle, best for local dev. | ||
# - A Java major version number, like 8, 11 or 17. | ||
nexusPublishPlugin.test.java=auto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# DO NOT MODIFY: Generated by Stutter plugin. | ||
java11=6.2.2,6.9.4,7.0.2,7.6.2,8.0.2,8.2.1 | ||
java17=7.3.3,7.6.2,8.0.2,8.2.1 | ||
java19=7.6.2,8.0.2,8.2.1 | ||
java8=6.2.2,6.9.4,7.0.2,7.6.2,8.0.2,8.2.1 | ||
javaauto=7.3.3,7.6.2,8.0.2,8.2.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we shouldn't have "fail-fast" disabled for that workflow?