3737 annotate_only : true
3838 job_summary : true
3939
40+ # The tests of `build` on the newer JDKs, in parallel with everything else: nothing waits for these
41+ # jobs and nothing they build is kept. The code is still compiled for Java 21 by JDK 21, as in the
42+ # release; -PjavaRuntime moves only the test JVMs, and with them the javac whose internals the
43+ # formatter parses with. The IntelliJ plugin's tests stay on the runtime of the IDE they start.
44+ # JDK 21 itself is `build`, the check the main branch requires.
45+ jdk :
46+ name : build (JDK ${{ matrix.jdk }})
47+ runs-on : ubuntu-latest
48+ strategy :
49+ fail-fast : false
50+ matrix :
51+ include :
52+ - jdk : 25
53+ gradle_args : ' '
54+ gradle_args_reason : ' '
55+ - jdk : 26
56+ gradle_args : ' '
57+ gradle_args_reason : ' '
58+ - jdk : 27
59+ gradle_args : -x :gradle-open-java-format:test
60+ gradle_args_reason : >-
61+ Gradle 9.7.1 does not run on Java 27 yet, and the Gradle plugin's tests run their TestKit builds on
62+ the test JVM, where they fail with "Unsupported class file major version 71". Those tests are left
63+ out until the wrapper's Gradle supports Java 27.
64+ steps :
65+ - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
66+
67+ - name : Install JDK ${{ matrix.jdk }} for the tests
68+ id : test-jdk
69+ uses : actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
70+ with :
71+ distribution : temurin
72+ java-version : ${{ matrix.jdk }}
73+
74+ # Installed last, so that it is the JAVA_HOME Gradle runs and compiles on.
75+ - name : Install JDK 21
76+ uses : actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
77+ with :
78+ distribution : temurin
79+ java-version : ' 21'
80+
81+ - name : Explain the extra Gradle arguments
82+ if : ${{ matrix.gradle_args != '' }}
83+ env :
84+ GRADLE_ARGS : ${{ matrix.gradle_args }}
85+ REASON : ${{ matrix.gradle_args_reason }}
86+ run : echo "::notice title=JDK ${{ matrix.jdk }} runs with $GRADLE_ARGS::$REASON"
87+
88+ # Gradle does not look into the runner's tool cache, so it is told where the test JDK is.
89+ - name : Build
90+ run : >-
91+ ./gradlew test -PjavaRuntime=${{ matrix.jdk }} ${{ matrix.gradle_args }}
92+ -Porg.gradle.java.installations.paths=${{ steps.test-jdk.outputs.path }}
93+
94+ - name : Publish Test Report
95+ uses : mikepenz/action-junit-report@a9170d5795813c01ab4901ffb045b52bab4ab09d # v6.5.0
96+ if : ${{ !cancelled() }}
97+ with :
98+ report_paths : ' **/build/test-results/test/*.xml'
99+ annotate_only : true
100+ job_summary : true
101+
40102 # One explicit job per target, so every binary we ship is traceable to a named run.
41103 native :
42104 name : native (${{ matrix.platform }})
87149 env :
88150 JDK21_HOME : ${{ steps.jdk21.outputs.path }}
89151
90- # The binary itself on a file that needs formatting, a formatted one and one that does not parse.
152+ # The binary itself on a file that needs formatting, a formatted one, one that does not parse and
153+ # one in Java 25 syntax.
91154 - name : Smoke-test the binary
92155 run : |
93156 binary="$PWD/$(ls open-java-format-native/build/native/nativeCompile/open-java-format-* | grep -v '\.txt$')"
@@ -100,6 +163,10 @@ jobs:
100163 printf 'class B {\n' > B.java
101164 set +e; "$binary" B.java; status=$?; set -e
102165 test "$status" -eq 2
166+ # Java 25 syntax: a compact source file with a module import and an unnamed pattern.
167+ printf 'import module java.base;\nrecord Box(int a,int b){}\nvoid main(){Object o=new Box(1,2);if(o instanceof Box(_,_)){IO.println(List.of(1));}}\n' > C.java
168+ "$binary" --replace C.java
169+ printf 'import module java.base;\n\nrecord Box(int a, int b) {}\n\nvoid main() {\n Object o = new Box(1, 2);\n if (o instanceof Box(_, _)) {\n IO.println(List.of(1));\n }\n}\n' | diff - C.java
103170
104171 - name : Test the plugins against the image
105172 run : ./gradlew -PnativeImage=true :open-java-format-jdk-bootstrap:test :gradle-open-java-format:test
0 commit comments