Skip to content

Commit

Permalink
Use GRADLE_JAVA_HOME in CI and test Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Oct 6, 2023
1 parent 94abdd4 commit 5f5bd50
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/matrix-jvm-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}]
18 changes: 17 additions & 1 deletion .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
Expand Down Expand Up @@ -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' }}

Expand Down

0 comments on commit 5f5bd50

Please sign in to comment.