1 #
2 # Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 name: 'OpenJDK GHA Sanity Checks'
27
28 on:
29 push:
30 branches-ignore:
31 - pr/*
32 workflow_dispatch:
33 inputs:
34 platforms:
35 description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")'
36 required: true
37 default: 'linux-x64, linux-x64-variants, linux-aarch64, linux-cross-compile, alpine-linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs'
38 configure-arguments:
39 description: 'Additional configure arguments'
40 required: false
41 make-arguments:
42 description: 'Additional make arguments'
43 required: false
44 dry-run:
45 description: 'Dry run: skip actual builds and tests'
46 required: false
47
48 concurrency:
49 group: ${{ github.workflow }}-${{ github.ref }}
50 cancel-in-progress: true
51
52 jobs:
53
54 ###
55 ### Determine platforms to include
56 ###
57
58 prepare:
59 name: 'Prepare the run'
60 runs-on: ubuntu-24.04
61 env:
62 # List of platforms to exclude by default
63 EXCLUDED_PLATFORMS: 'alpine-linux-x64'
64 outputs:
65 linux-x64: ${{ steps.include.outputs.linux-x64 }}
66 linux-x64-variants: ${{ steps.include.outputs.linux-x64-variants }}
67 linux-aarch64: ${{ steps.include.outputs.linux-aarch64 }}
68 linux-cross-compile: ${{ steps.include.outputs.linux-cross-compile }}
69 alpine-linux-x64: ${{ steps.include.outputs.alpine-linux-x64 }}
70 macos-x64: ${{ steps.include.outputs.macos-x64 }}
71 macos-aarch64: ${{ steps.include.outputs.macos-aarch64 }}
72 windows-x64: ${{ steps.include.outputs.windows-x64 }}
73 windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
74 docs: ${{ steps.include.outputs.docs }}
75 dry-run: ${{ steps.include.outputs.dry-run }}
76
77 steps:
78 - name: 'Checkout the scripts'
79 uses: actions/checkout@v6
80 with:
81 sparse-checkout: |
82 .github
83 make/conf/github-actions.conf
84
85 - name: 'Build JTReg'
86 id: jtreg
87 uses: ./.github/actions/build-jtreg
88
89 # TODO: Now that we are checking out the repo scripts, we can put the following code
90 # into a separate file
91 - name: 'Check what jobs to run'
92 id: include
93 run: |
94 # Determine which platform jobs to run
95
96 # Returns 'true' if the input platform list matches any of the platform monikers given as argument,
97 # 'false' otherwise.
98 # arg $1: platform name or names to look for
99
100 # Convert EXCLUDED_PLATFORMS from a comma-separated string to an array
101 IFS=',' read -r -a excluded_array <<< "$EXCLUDED_PLATFORMS"
102
103 function check_platform() {
104 if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
105 input='${{ github.event.inputs.platforms }}'
106 elif [[ $GITHUB_EVENT_NAME == push ]]; then
107 if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then
108 # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything
109 >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch'
110 echo 'false'
111 return
112 else
113 input='${{ secrets.JDK_SUBMIT_PLATFORMS }}'
114 fi
115 fi
116
117 normalized_input="$(echo ,$input, | tr -d ' ')"
118 if [[ "$normalized_input" == ",," ]]; then
119 # For an empty input, assume all platforms should run, except those in the EXCLUDED_PLATFORMS list
120 for excluded in "${excluded_array[@]}"; do
121 if [[ "$1" == "$excluded" ]]; then
122 echo 'false'
123 return
124 fi
125 done
126 echo 'true'
127 return
128 else
129 # Check for all acceptable platform names
130 for part in $* ; do
131 if echo "$normalized_input" | grep -q -e ",$part," ; then
132 echo 'true'
133 return
134 fi
135 done
136
137 # If not explicitly included, check against the EXCLUDED_PLATFORMS list
138 for excluded in "${excluded_array[@]}"; do
139 if [[ "$1" == "$excluded" ]]; then
140 echo 'false'
141 return
142 fi
143 done
144 fi
145
146 echo 'false'
147 }
148
149 function check_dry_run() {
150 if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
151 # Take the user-specified one.
152 echo '${{ github.event.inputs.dry-run }}'
153 return
154 elif [[ $GITHUB_EVENT_NAME == push ]]; then
155 # Cut out the real branch name
156 BRANCH=${GITHUB_REF##*/}
157
158 # Dry run rebuilds the caches in current branch, so they can be reused
159 # for any child PR branches. Because of this, we want to trigger this
160 # workflow in master branch, so that actual PR branches can use the cache.
161 # This workflow would trigger every time contributors sync their master
162 # branches in their personal forks.
163 if [[ $BRANCH == "master" ]]; then
164 echo 'true'
165 return
166 fi
167
168 # ...same for stabilization branches
169 if [[ $BRANCH =~ "jdk(.*)" ]]; then
170 echo 'true'
171 return
172 fi
173 fi
174
175 echo 'false'
176 }
177
178 echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
179 echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
180 echo "linux-aarch64=$(check_platform linux-aarch64 linux aarch64)" >> $GITHUB_OUTPUT
181 echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
182 echo "alpine-linux-x64=$(check_platform alpine-linux-x64 alpine-linux x64)" >> $GITHUB_OUTPUT
183 echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT
184 echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT
185 echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
186 echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
187 echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
188 echo "dry-run=$(check_dry_run)" >> $GITHUB_OUTPUT
189
190 ###
191 ### Build jobs
192 ###
193
194 build-linux-x64:
195 name: linux-x64
196 needs: prepare
197 uses: ./.github/workflows/build-linux.yml
198 with:
199 platform: linux-x64
200 gcc-major-version: '10'
201 configure-arguments: ${{ github.event.inputs.configure-arguments }}
202 make-arguments: ${{ github.event.inputs.make-arguments }}
203 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
204 if: needs.prepare.outputs.linux-x64 == 'true'
205
206 build-linux-aarch64:
207 name: linux-aarch64
208 needs: prepare
209 uses: ./.github/workflows/build-linux.yml
210 with:
211 platform: linux-aarch64
212 runs-on: 'ubuntu-24.04-arm'
213 bootjdk-platform: linux-aarch64
214 gcc-major-version: '14'
215 configure-arguments: ${{ github.event.inputs.configure-arguments }}
216 make-arguments: ${{ github.event.inputs.make-arguments }}
217 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
218 if: needs.prepare.outputs.linux-aarch64 == 'true'
219
220 build-linux-x64-hs-nopch:
221 name: linux-x64-hs-nopch
222 needs: prepare
223 uses: ./.github/workflows/build-linux.yml
224 with:
225 platform: linux-x64
226 make-target: 'hotspot'
227 debug-levels: '[ "debug" ]'
228 gcc-major-version: '10'
229 extra-conf-options: '--disable-precompiled-headers'
230 configure-arguments: ${{ github.event.inputs.configure-arguments }}
231 make-arguments: ${{ github.event.inputs.make-arguments }}
232 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
233 if: needs.prepare.outputs.linux-x64-variants == 'true'
234
235 build-linux-x64-hs-zero:
236 name: linux-x64-hs-zero
237 needs: prepare
238 uses: ./.github/workflows/build-linux.yml
239 with:
240 platform: linux-x64
241 make-target: 'hotspot'
242 debug-levels: '[ "debug" ]'
243 gcc-major-version: '10'
244 extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
245 configure-arguments: ${{ github.event.inputs.configure-arguments }}
246 make-arguments: ${{ github.event.inputs.make-arguments }}
247 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
248 if: needs.prepare.outputs.linux-x64-variants == 'true'
249
250 build-linux-x64-hs-minimal:
251 name: linux-x64-hs-minimal
252 needs: prepare
253 uses: ./.github/workflows/build-linux.yml
254 with:
255 platform: linux-x64
256 make-target: 'hotspot'
257 debug-levels: '[ "debug" ]'
258 gcc-major-version: '10'
259 extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
260 configure-arguments: ${{ github.event.inputs.configure-arguments }}
261 make-arguments: ${{ github.event.inputs.make-arguments }}
262 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
263 if: needs.prepare.outputs.linux-x64-variants == 'true'
264
265 build-linux-x64-hs-optimized:
266 name: linux-x64-hs-optimized
267 needs: prepare
268 uses: ./.github/workflows/build-linux.yml
269 with:
270 platform: linux-x64
271 make-target: 'hotspot'
272 # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
273 debug-levels: '[ "debug" ]'
274 gcc-major-version: '10'
275 extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
276 configure-arguments: ${{ github.event.inputs.configure-arguments }}
277 make-arguments: ${{ github.event.inputs.make-arguments }}
278 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
279 if: needs.prepare.outputs.linux-x64-variants == 'true'
280
281 build-linux-x64-static:
282 name: linux-x64-static
283 needs: prepare
284 uses: ./.github/workflows/build-linux.yml
285 with:
286 platform: linux-x64
287 make-target: 'static-jdk-bundles'
288 # There are issues with fastdebug static build in GHA due to space limit.
289 # Only do release build for now.
290 debug-levels: '[ "release" ]'
291 gcc-major-version: '10'
292 configure-arguments: ${{ github.event.inputs.configure-arguments }}
293 make-arguments: ${{ github.event.inputs.make-arguments }}
294 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
295 static-suffix: "-static"
296 if: needs.prepare.outputs.linux-x64 == 'true'
297
298 build-linux-x64-static-libs:
299 name: linux-x64-static-libs
300 needs: prepare
301 uses: ./.github/workflows/build-linux.yml
302 with:
303 platform: linux-x64
304 make-target: 'static-libs-bundles'
305 # Only build static-libs-bundles for release builds.
306 # For debug builds, building static-libs often exceeds disk space.
307 debug-levels: '[ "release" ]'
308 gcc-major-version: '10'
309 configure-arguments: ${{ github.event.inputs.configure-arguments }}
310 make-arguments: ${{ github.event.inputs.make-arguments }}
311 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
312 # Upload static libs bundles separately to avoid interference with normal linux-x64 bundle.
313 # This bundle is not used by testing jobs, but downstreams use it to check that
314 # dependent projects, e.g. libgraal, builds fine.
315 bundle-suffix: "-static-libs"
316 if: needs.prepare.outputs.linux-x64-variants == 'true'
317
318 build-linux-cross-compile:
319 name: linux-cross-compile
320 needs: prepare
321 uses: ./.github/workflows/build-cross-compile.yml
322 with:
323 gcc-major-version: '10'
324 configure-arguments: ${{ github.event.inputs.configure-arguments }}
325 make-arguments: ${{ github.event.inputs.make-arguments }}
326 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
327 if: needs.prepare.outputs.linux-cross-compile == 'true'
328
329 build-alpine-linux-x64:
330 name: alpine-linux-x64
331 needs: prepare
332 uses: ./.github/workflows/build-alpine-linux.yml
333 with:
334 platform: alpine-linux-x64
335 configure-arguments: ${{ github.event.inputs.configure-arguments }}
336 make-arguments: ${{ github.event.inputs.make-arguments }}
337 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
338 if: needs.prepare.outputs.alpine-linux-x64 == 'true'
339
340 build-macos-x64:
341 name: macos-x64
342 needs: prepare
343 uses: ./.github/workflows/build-macos.yml
344 with:
345 platform: macos-x64
346 runs-on: 'macos-15-intel'
347 xcode-toolset-version: '16.4'
348 configure-arguments: ${{ github.event.inputs.configure-arguments }}
349 make-arguments: ${{ github.event.inputs.make-arguments }}
350 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
351 if: needs.prepare.outputs.macos-x64 == 'true'
352
353 build-macos-aarch64:
354 name: macos-aarch64
355 needs: prepare
356 uses: ./.github/workflows/build-macos.yml
357 with:
358 platform: macos-aarch64
359 runs-on: 'macos-15'
360 xcode-toolset-version: '16.4'
361 configure-arguments: ${{ github.event.inputs.configure-arguments }}
362 make-arguments: ${{ github.event.inputs.make-arguments }}
363 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
364 if: needs.prepare.outputs.macos-aarch64 == 'true'
365
366 build-windows-x64:
367 name: windows-x64
368 needs: prepare
369 uses: ./.github/workflows/build-windows.yml
370 with:
371 platform: windows-x64
372 runs-on: windows-2022
373 msvc-toolset-version: '14.44'
374 msvc-toolset-architecture: 'x86.x64'
375 configure-arguments: ${{ github.event.inputs.configure-arguments }}
376 make-arguments: ${{ github.event.inputs.make-arguments }}
377 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
378 if: needs.prepare.outputs.windows-x64 == 'true'
379
380 build-windows-aarch64:
381 name: windows-aarch64
382 needs: prepare
383 uses: ./.github/workflows/build-windows.yml
384 with:
385 platform: windows-aarch64
386 runs-on: windows-2022
387 msvc-toolset-version: '14.44'
388 msvc-toolset-architecture: 'arm64'
389 make-target: 'hotspot'
390 extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
391 configure-arguments: ${{ github.event.inputs.configure-arguments }}
392 make-arguments: ${{ github.event.inputs.make-arguments }}
393 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
394 if: needs.prepare.outputs.windows-aarch64 == 'true'
395
396 build-docs:
397 name: docs
398 needs: prepare
399 uses: ./.github/workflows/build-linux.yml
400 with:
401 platform: linux-x64
402 debug-levels: '[ "debug" ]'
403 make-target: 'docs-jdk-bundles'
404 # Make sure we never try to make full docs, since that would require a
405 # build JDK, and we do not need the additional testing of the graphs.
406 extra-conf-options: '--disable-full-docs'
407 gcc-major-version: '10'
408 configure-arguments: ${{ github.event.inputs.configure-arguments }}
409 make-arguments: ${{ github.event.inputs.make-arguments }}
410 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
411 if: needs.prepare.outputs.docs == 'true'
412
413 ###
414 ### Test jobs
415 ###
416
417 test-linux-x64:
418 name: linux-x64
419 needs:
420 - prepare
421 - build-linux-x64
422 uses: ./.github/workflows/test.yml
423 with:
424 platform: linux-x64
425 bootjdk-platform: linux-x64
426 runs-on: ubuntu-24.04
427 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
428 debug-suffix: -debug
429
430 test-linux-x64-static:
431 name: linux-x64-static
432 needs:
433 - prepare
434 - build-linux-x64
435 - build-linux-x64-static
436 uses: ./.github/workflows/test.yml
437 with:
438 platform: linux-x64
439 bootjdk-platform: linux-x64
440 runs-on: ubuntu-24.04
441 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
442 static-suffix: "-static"
443
444 test-linux-aarch64:
445 name: linux-aarch64
446 needs:
447 - prepare
448 - build-linux-aarch64
449 uses: ./.github/workflows/test.yml
450 with:
451 platform: linux-aarch64
452 bootjdk-platform: linux-aarch64
453 runs-on: ubuntu-24.04-arm
454 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
455 debug-suffix: -debug
456
457 test-macos-aarch64:
458 name: macos-aarch64
459 needs:
460 - prepare
461 - build-macos-aarch64
462 uses: ./.github/workflows/test.yml
463 with:
464 platform: macos-aarch64
465 bootjdk-platform: macos-aarch64
466 runs-on: macos-15
467 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
468 xcode-toolset-version: '16.4'
469 debug-suffix: -debug
470
471 test-windows-x64:
472 name: windows-x64
473 needs:
474 - prepare
475 - build-windows-x64
476 uses: ./.github/workflows/test.yml
477 with:
478 platform: windows-x64
479 bootjdk-platform: windows-x64
480 runs-on: windows-2022
481 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
482 debug-suffix: -debug