@@ -32,43 +32,59 @@ jobs:
3232 with :
3333 fetch-depth : 0
3434
35- # Always install a JDK first (Windows uses this; Linux will be overridden below for jlink)
36- - name : Setup Temurin JDK 25
35+ # Optional: still install a JDK so Gradle wrapper validation etc. have a JVM before we switch
36+ - name : Setup Temurin JDK 25 (baseline)
3737 uses : actions/setup-java@v4
3838 with :
3939 distribution : temurin
4040 java-version : ' 25'
4141 cache : ' gradle'
4242
43- # On Ubuntu, fetch a *portable* pristine Temurin JDK 25 just for jlink (isolated from system JDKs)
44- - name : (Linux) Install portable Temurin 25 for jlink
43+ # ---------- Portable JDK for Linux ----------
44+ - name : (Linux) Install portable Temurin 25
4545 if : runner.os == 'Linux'
4646 shell : bash
4747 run : |
4848 set -euo pipefail
49- VER="25.0.0+36"
50- BASE="jdk-25.0.0+36"
51- URL="https://github.com/adoptium/temurin25-binaries/releases/download/${BASE}/OpenJDK25U-jdk_x64_linux_hotspot_25.0.0_36.tar.gz"
49+ URL="https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25%2B36/OpenJDK25U-jdk_x64_linux_hotspot_25_36.tar.gz"
5250 mkdir -p "$RUNNER_TEMP/temurin25"
5351 echo "Downloading $URL"
54- curl -L "$URL" -o "$RUNNER_TEMP/temurin25/jdk.tar.gz"
52+ curl -fsSL "$URL" -o "$RUNNER_TEMP/temurin25/jdk.tar.gz"
5553 tar -xzf "$RUNNER_TEMP/temurin25/jdk.tar.gz" -C "$RUNNER_TEMP/temurin25"
5654 PORTABLE_JAVA_HOME="$(find "$RUNNER_TEMP/temurin25" -maxdepth 1 -type d -name 'jdk-25*' | head -n1)"
5755 echo "PORTABLE_JAVA_HOME=$PORTABLE_JAVA_HOME" >> "$GITHUB_ENV"
5856 echo "$PORTABLE_JAVA_HOME/bin" >> "$GITHUB_PATH"
5957
60- # Pin Gradle toolchain discovery to whatever JAVA_HOME is active at execution time
61- - name : Pin Gradle toolchain
58+ # ---------- Portable JDK for Windows ----------
59+ - name : (Windows) Install portable Temurin 25
60+ if : runner.os == 'Windows'
61+ shell : powershell
62+ run : |
63+ $ErrorActionPreference = 'Stop'
64+ $url = 'https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25%2B36/OpenJDK25U-jdk_x64_windows_hotspot_25_36.zip'
65+ $root = "$env:RUNNER_TEMP\temurin25"
66+ New-Item -ItemType Directory -Force -Path $root | Out-Null
67+ Write-Host "Downloading $url"
68+ Invoke-WebRequest -Uri $url -OutFile "$root\jdk.zip"
69+ Expand-Archive -Path "$root\jdk.zip" -DestinationPath $root -Force
70+ $dir = Get-ChildItem -Path $root -Directory | Where-Object { $_.Name -like 'jdk-25*' } | Select-Object -First 1
71+ if (-not $dir) { throw "Extracted JDK directory not found under $root" }
72+ $pjh = $dir.FullName
73+ "PORTABLE_JAVA_HOME=$pjh" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
74+ "$pjh\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8
75+
76+ # Pin Gradle toolchain to the active (portable) JAVA_HOME
77+ - name : Pin Gradle toolchain to portable JDK
6278 shell : bash
6379 run : |
64- # If we installed a portable JDK (Linux), use that; otherwise use setup-java's JAVA_HOME.
6580 ACTIVE_JAVA_HOME="${PORTABLE_JAVA_HOME:-$JAVA_HOME}"
66- echo "org.gradle.java.installations.paths=${ACTIVE_JAVA_HOME}" >> gradle.properties
67- echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties
6881 echo "JAVA_HOME=${ACTIVE_JAVA_HOME}" >> "$GITHUB_ENV"
6982 echo "${ACTIVE_JAVA_HOME}/bin" >> "$GITHUB_PATH"
83+ # write gradle.properties in repo root (defaults.working-directory is already the module)
84+ echo "org.gradle.java.installations.paths=${ACTIVE_JAVA_HOME}" >> gradle.properties
85+ echo "org.gradle.java.installations.auto-detect=false" >> gradle.properties
7086
71- # Sanity print (bash works on both runners)
87+ # Cross-shell sanity print (bash works on both runners)
7288 - name : Show Java & jlink
7389 shell : bash
7490 run : |
87103 shell : bash
88104 run : ./gradlew checksumSlimCompilerDist --no-daemon --stacktrace
89105
90- # If packaging passed, *then* run tests
106+ # Only run tests if packaging passed
91107 - name : Run tests
92108 shell : bash
93109 run : ./gradlew test --no-daemon --stacktrace
0 commit comments