From ace94f175ab0dc3ab136cbcf588667fee9167027 Mon Sep 17 00:00:00 2001 From: Joke de Buhr Date: Sun, 10 Mar 2024 18:52:28 +0100 Subject: [PATCH] ci: build with multiple jdk versions Signed-off-by: Joke de Buhr --- .github/workflows/build.yml | 8 ++++---- .github/workflows/release.yml | 7 +++---- .mise.toml | 3 +++ build.gradle | 7 +++++-- examples/springboot/build.gradle | 34 +++++++++++++++++++------------- spock-outputcapture/build.gradle | 6 ++++++ 6 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 .mise.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 801e2f8..2e44e29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,9 +13,9 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v4 - with: - java-version: 8 - distribution: zulu + - uses: jdx/mise-action@v2 + - uses: gradle/actions/setup-gradle@v3 - name: build run: ./gradlew check + env: + ASDF_DATA_DIR: /home/runner/.local/share/mise diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8ddc36b..bd6e258 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,13 +28,12 @@ jobs: - uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - - uses: actions/setup-java@v4 - with: - java-version: 8 - distribution: zulu + - uses: jdx/mise-action@v2 + - uses: gradle/actions/setup-gradle@v3 - name: publish run: ./gradlew publish env: + ASDF_DATA_DIR: /home/runner/.local/share/mise ORG_GRADLE_PROJECT_OSSRHUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_OSSRHPassword: ${{ secrets.OSSRH_TOKEN }} ORG_GRADLE_PROJECT_GitHubPackagesUsername: ${{ secrets.GITHUB_ACTOR }} diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 0000000..d792bc1 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,3 @@ +# https://github.com/jdx/mise +[tools] +java = ['zulu-17.46.19', 'zulu-8.74.0.17'] diff --git a/build.gradle b/build.gradle index cb72d15..fad8432 100644 --- a/build.gradle +++ b/build.gradle @@ -13,8 +13,11 @@ allprojects { project -> } plugins.withType(JavaBasePlugin).configureEach { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } + } } plugins.withType(MavenPublishPlugin) { diff --git a/examples/springboot/build.gradle b/examples/springboot/build.gradle index 6b455f7..bbcf348 100644 --- a/examples/springboot/build.gradle +++ b/examples/springboot/build.gradle @@ -17,11 +17,17 @@ versions.forEach { } } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + dependencies { - compileOnly platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + compileOnly platform('org.springframework.boot:spring-boot-dependencies:2.7.1') compileOnly 'org.springframework.boot:spring-boot-starter-web' - testImplementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + testImplementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') testImplementation platform('org.codehaus.groovy:groovy-bom:3.0.21') testImplementation platform('org.spockframework:spock-bom:2.1-groovy-3.0') testImplementation project(':spock-outputcapture') @@ -29,23 +35,23 @@ dependencies { testImplementation 'org.spockframework:spock-spring' testImplementation 'org.springframework.boot:spring-boot-starter-test' - spock20groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.18')) { + spock20groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.1')) { exclude group: 'org.codehaus.groovy', module: '*' } - spock20groovy25Implementation platform('org.codehaus.groovy:groovy-bom:2.5.23') - spock20groovy25Implementation platform('org.spockframework:spock-bom:2.0-groovy-2.5') + spock20groovy25Implementation enforcedPlatform('org.codehaus.groovy:groovy-bom:2.5.23') + spock20groovy25Implementation enforcedPlatform('org.spockframework:spock-bom:2.0-groovy-2.5') spock20groovy25Implementation project(':spock-outputcapture') spock20groovy25Implementation 'org.spockframework:spock-spring' spock20groovy25Implementation 'org.springframework.boot:spring-boot-starter-test' - spock20groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock20groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock20groovy30Implementation platform('org.codehaus.groovy:groovy-bom:3.0.21') spock20groovy30Implementation platform('org.spockframework:spock-bom:2.0-groovy-3.0') spock20groovy30Implementation project(':spock-outputcapture') spock20groovy30Implementation 'org.spockframework:spock-spring' spock20groovy30Implementation 'org.springframework.boot:spring-boot-starter-test' - spock21groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.18')) { + spock21groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.1')) { exclude group: 'org.codehaus.groovy', module: '*' } spock21groovy25Implementation platform('org.codehaus.groovy:groovy-bom:2.5.23') @@ -54,14 +60,14 @@ dependencies { spock21groovy25Implementation 'org.spockframework:spock-spring' spock21groovy25Implementation 'org.springframework.boot:spring-boot-starter-test' - spock21groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock21groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock21groovy30Implementation platform('org.codehaus.groovy:groovy-bom:3.0.21') spock21groovy30Implementation platform('org.spockframework:spock-bom:2.1-groovy-3.0') spock21groovy30Implementation project(':spock-outputcapture') spock21groovy30Implementation 'org.spockframework:spock-spring' spock21groovy30Implementation 'org.springframework.boot:spring-boot-starter-test' - spock22groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.18')) { + spock22groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.1')) { exclude group: 'org.codehaus.groovy', module: '*' } spock22groovy25Implementation platform('org.codehaus.groovy:groovy-bom:2.5.23') @@ -70,21 +76,21 @@ dependencies { spock22groovy25Implementation 'org.spockframework:spock-spring' spock22groovy25Implementation 'org.springframework.boot:spring-boot-starter-test' - spock22groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock22groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock22groovy30Implementation platform('org.codehaus.groovy:groovy-bom:3.0.21') spock22groovy30Implementation platform('org.spockframework:spock-bom:2.2-groovy-3.0') spock22groovy30Implementation project(':spock-outputcapture') spock22groovy30Implementation 'org.spockframework:spock-spring' spock22groovy30Implementation 'org.springframework.boot:spring-boot-starter-test' - spock22groovy40Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock22groovy40Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock22groovy40Implementation platform('org.apache.groovy:groovy-bom:4.0.19') spock22groovy40Implementation platform('org.spockframework:spock-bom:2.2-groovy-4.0') spock22groovy40Implementation project(':spock-outputcapture') spock22groovy40Implementation 'org.spockframework:spock-spring' spock22groovy40Implementation 'org.springframework.boot:spring-boot-starter-test' - spock23groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.18')) { + spock23groovy25Implementation(platform('org.springframework.boot:spring-boot-dependencies:2.7.1')) { exclude group: 'org.codehaus.groovy', module: '*' } spock23groovy25Implementation platform('org.codehaus.groovy:groovy-bom:2.5.23') @@ -93,14 +99,14 @@ dependencies { spock23groovy25Implementation 'org.spockframework:spock-spring' spock23groovy25Implementation 'org.springframework.boot:spring-boot-starter-test' - spock23groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock23groovy30Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock23groovy30Implementation platform('org.codehaus.groovy:groovy-bom:3.0.21') spock23groovy30Implementation platform('org.spockframework:spock-bom:2.3-groovy-3.0') spock23groovy30Implementation project(':spock-outputcapture') spock23groovy30Implementation 'org.spockframework:spock-spring' spock23groovy30Implementation 'org.springframework.boot:spring-boot-starter-test' - spock23groovy40Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.18') + spock23groovy40Implementation platform('org.springframework.boot:spring-boot-dependencies:2.7.1') spock23groovy40Implementation platform('org.apache.groovy:groovy-bom:4.0.19') spock23groovy40Implementation platform('org.spockframework:spock-bom:2.3-groovy-4.0') spock23groovy40Implementation project(':spock-outputcapture') diff --git a/spock-outputcapture/build.gradle b/spock-outputcapture/build.gradle index 24ee8be..c54c8ea 100644 --- a/spock-outputcapture/build.gradle +++ b/spock-outputcapture/build.gradle @@ -16,6 +16,12 @@ dependencies { compileOnly 'org.spockframework:spock-core' } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + publishing { publications { spockOutputCapture(MavenPublication) {