Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,49 @@ jobs:
annotate_only: true
job_summary: true

# The tests of `build` on the newer JDKs, in parallel with everything else: nothing waits for these
# jobs and nothing they build is kept. The code is still compiled for Java 21 by JDK 21, as in the
# release; -PjavaRuntime moves only the test JVMs, and with them the javac whose internals the
# formatter parses with. The IntelliJ plugin's tests stay on the runtime of the IDE they start.
# JDK 21 itself is `build`, the check the main branch requires.
jdk:
name: build (JDK ${{ matrix.jdk }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
jdk: [25, 26, 27]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Install JDK ${{ matrix.jdk }} for the tests
id: test-jdk
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: temurin
java-version: ${{ matrix.jdk }}

# Installed last, so that it is the JAVA_HOME Gradle runs and compiles on.
- name: Install JDK 21
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: temurin
java-version: '21'

# Gradle does not look into the runner's tool cache, so it is told where the test JDK is.
- name: Build
run: >-
./gradlew test -PjavaRuntime=${{ matrix.jdk }}
-Porg.gradle.java.installations.paths=${{ steps.test-jdk.outputs.path }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@a9170d5795813c01ab4901ffb045b52bab4ab09d # v6.5.0
if: ${{ !cancelled() }}
with:
report_paths: '**/build/test-results/test/*.xml'
annotate_only: true
job_summary: true

# One explicit job per target, so every binary we ship is traceable to a named run.
native:
name: native (${{ matrix.platform }})
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ mise trust && mise install
./gradlew test # what the CI build job runs
```

`-PjavaRuntime=25` runs the same tests on JDK 25, as CI's `jdk` jobs do for 25, 26 and 27. The code
is compiled for Java 21 either way. Gradle has to find that JDK: installed with mise, or named with
`-Porg.gradle.java.installations.paths=/path/to/jdk`.

Nothing inside the build downloads a JDK. `gradle.properties` turns toolchain auto-download off and
reads the installations from `JDK21_HOME` and `GRAALVM_HOME`, so a missing JDK is an error you can
read rather than a silent download.
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,7 @@ subprojects {

javaVersions {
libraryTarget = 21
runtime = 21
// The JDK the tests run on, and with it the javac whose internals the formatter parses with. The code is
// compiled for 21 whatever this says. CI's `jdk` jobs pass -PjavaRuntime=25 and so on.
runtime = providers.gradleProperty('javaRuntime').getOrElse('21')
}
Loading