From 5f5bd5017b87c9798cf7340f3f780abfde994afe Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 4 Oct 2023 13:34:15 +0200 Subject: [PATCH] Use GRADLE_JAVA_HOME in CI and test Java 21 --- .github/matrix-jvm-tests.json | 8 +++++--- .github/workflows/ci-actions-incremental.yml | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/matrix-jvm-tests.json b/.github/matrix-jvm-tests.json index e4ace13213865..87367d3ec7251 100644 --- a/.github/matrix-jvm-tests.json +++ b/.github/matrix-jvm-tests.json @@ -13,8 +13,10 @@ "os-name": "ubuntu-latest" } , { - "name": "20", - "java-version": 20, + "name": "21", + "java-version": 21, + "java-distribution": "oracle", + "java-version-gradle": 20, "maven_args": "$JVM_TEST_MAVEN_ARGS", "maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g", "os-name": "ubuntu-latest" @@ -24,5 +26,5 @@ "java-version": 17, "maven_args": "-DskipDocs -Dformat.skip", "maven_opts": "-Xmx2g -XX:MaxMetaspaceSize=1g -Xlog:gc*=debug:file=windows-java-17.txt", - "os-name": "windows-latest" + "os-name": "windows-latest" }] diff --git a/.github/workflows/ci-actions-incremental.yml b/.github/workflows/ci-actions-incremental.yml index 4423a550a06ea..11f14df39a395 100644 --- a/.github/workflows/ci-actions-incremental.yml +++ b/.github/workflows/ci-actions-incremental.yml @@ -277,6 +277,7 @@ jobs: timeout-minutes: 400 env: MAVEN_OPTS: ${{ matrix.java.maven_opts }} + JAVA_VERSION_GRADLE: ${{ matrix.java.java-version-gradle || matrix.java.java-version }} strategy: fail-fast: false matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.jvm_matrix) }} @@ -309,10 +310,25 @@ jobs: if: "!startsWith(matrix.java.os-name, 'windows') && !startsWith(matrix.java.os-name, 'macos')" run: .github/ci-prerequisites.sh - - name: Set up JDK ${{ matrix.java.java-version }} + - name: Set up JDK ${{ env.JAVA_VERSION_GRADLE }} for Gradle (if needed) + if: ${{ env.JAVA_VERSION_GRADLE != matrix.java.java-version }} uses: actions/setup-java@v3 with: distribution: temurin + java-version: ${{ matrix.java.java-version-gradle }} + architecture: ${{ matrix.java.architecture || 'x64' }} + + - name: Set up GRADLE_JAVA_HOME (if needed) + if: ${{ env.JAVA_VERSION_GRADLE != matrix.java.java-version }} + run: | + JAVA_HOME_ARCHITECTURE=$(echo "${{ matrix.java.architecture || 'x64' }}" | tr [:lower:] [:upper:]) + GRADLE_JAVA_HOME_VARIABLE="JAVA_HOME_${JAVA_VERSION_GRADLE}_${JAVA_HOME_ARCHITECTURE}" + echo "GRADLE_JAVA_HOME=${!GRADLE_JAVA_HOME_VARIABLE}" >> "$GITHUB_ENV" + + - name: Set up JDK ${{ matrix.java.java-version }} + uses: actions/setup-java@v3 + with: + distribution: ${{ matrix.java.java-distribution || 'temurin' }} java-version: ${{ matrix.java.java-version }} architecture: ${{ matrix.java.architecture || 'x64' }}