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
174 # ...same for project branch
175 if [[ $BRANCH == "lworld" ]]; then
176 echo 'true'
177 return
178 fi
179 fi
180
181 echo 'false'
182 }
183
184 echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
185 echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
186 echo "linux-aarch64=$(check_platform linux-aarch64 linux aarch64)" >> $GITHUB_OUTPUT
187 echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
188 echo "alpine-linux-x64=$(check_platform alpine-linux-x64 alpine-linux x64)" >> $GITHUB_OUTPUT
189 echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT
190 echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT
191 echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
192 echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
193 echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
194 echo "dry-run=$(check_dry_run)" >> $GITHUB_OUTPUT
195
196 ###
197 ### Build jobs
198 ###
199
200 build-linux-x64:
201 name: linux-x64
202 needs: prepare
203 uses: ./.github/workflows/build-linux.yml
204 with:
205 platform: linux-x64
206 gcc-major-version: '10'
207 configure-arguments: ${{ github.event.inputs.configure-arguments }}
208 make-arguments: ${{ github.event.inputs.make-arguments }}
209 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
210 if: needs.prepare.outputs.linux-x64 == 'true'
211
212 build-linux-aarch64:
213 name: linux-aarch64
214 needs: prepare
215 uses: ./.github/workflows/build-linux.yml
216 with:
217 platform: linux-aarch64
218 runs-on: 'ubuntu-24.04-arm'
219 bootjdk-platform: linux-aarch64
220 gcc-major-version: '14'
221 configure-arguments: ${{ github.event.inputs.configure-arguments }}
222 make-arguments: ${{ github.event.inputs.make-arguments }}
223 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
224 if: needs.prepare.outputs.linux-aarch64 == 'true'
225
226 build-linux-x64-hs-nopch:
227 name: linux-x64-hs-nopch
228 needs: prepare
229 uses: ./.github/workflows/build-linux.yml
230 with:
231 platform: linux-x64
232 make-target: 'hotspot'
233 debug-levels: '[ "debug" ]'
234 gcc-major-version: '10'
235 extra-conf-options: '--disable-precompiled-headers'
236 configure-arguments: ${{ github.event.inputs.configure-arguments }}
237 make-arguments: ${{ github.event.inputs.make-arguments }}
238 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
239 if: needs.prepare.outputs.linux-x64-variants == 'true'
240
241 build-linux-x64-hs-zero:
242 name: linux-x64-hs-zero
243 needs: prepare
244 uses: ./.github/workflows/build-linux.yml
245 with:
246 platform: linux-x64
247 make-target: 'hotspot'
248 debug-levels: '[ "debug" ]'
249 gcc-major-version: '10'
250 extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
251 configure-arguments: ${{ github.event.inputs.configure-arguments }}
252 make-arguments: ${{ github.event.inputs.make-arguments }}
253 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
254 if: needs.prepare.outputs.linux-x64-variants == 'true'
255
256 build-linux-x64-hs-minimal:
257 name: linux-x64-hs-minimal
258 needs: prepare
259 uses: ./.github/workflows/build-linux.yml
260 with:
261 platform: linux-x64
262 make-target: 'hotspot'
263 debug-levels: '[ "debug" ]'
264 gcc-major-version: '10'
265 extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
266 configure-arguments: ${{ github.event.inputs.configure-arguments }}
267 make-arguments: ${{ github.event.inputs.make-arguments }}
268 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
269 if: needs.prepare.outputs.linux-x64-variants == 'true'
270
271 build-linux-x64-hs-optimized:
272 name: linux-x64-hs-optimized
273 needs: prepare
274 uses: ./.github/workflows/build-linux.yml
275 with:
276 platform: linux-x64
277 make-target: 'hotspot'
278 # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
279 debug-levels: '[ "debug" ]'
280 gcc-major-version: '10'
281 extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
282 configure-arguments: ${{ github.event.inputs.configure-arguments }}
283 make-arguments: ${{ github.event.inputs.make-arguments }}
284 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
285 if: needs.prepare.outputs.linux-x64-variants == 'true'
286
287 build-linux-x64-static:
288 name: linux-x64-static
289 needs: prepare
290 uses: ./.github/workflows/build-linux.yml
291 with:
292 platform: linux-x64
293 make-target: 'static-jdk-bundles'
294 # There are issues with fastdebug static build in GHA due to space limit.
295 # Only do release build for now.
296 debug-levels: '[ "release" ]'
297 gcc-major-version: '10'
298 configure-arguments: ${{ github.event.inputs.configure-arguments }}
299 make-arguments: ${{ github.event.inputs.make-arguments }}
300 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
301 static-suffix: "-static"
302 if: needs.prepare.outputs.linux-x64 == 'true'
303
304 build-linux-x64-static-libs:
305 name: linux-x64-static-libs
306 needs: prepare
307 uses: ./.github/workflows/build-linux.yml
308 with:
309 platform: linux-x64
310 make-target: 'static-libs-bundles'
311 # Only build static-libs-bundles for release builds.
312 # For debug builds, building static-libs often exceeds disk space.
313 debug-levels: '[ "release" ]'
314 gcc-major-version: '10'
315 configure-arguments: ${{ github.event.inputs.configure-arguments }}
316 make-arguments: ${{ github.event.inputs.make-arguments }}
317 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
318 # Upload static libs bundles separately to avoid interference with normal linux-x64 bundle.
319 # This bundle is not used by testing jobs, but downstreams use it to check that
320 # dependent projects, e.g. libgraal, builds fine.
321 bundle-suffix: "-static-libs"
322 if: needs.prepare.outputs.linux-x64-variants == 'true'
323
324 build-linux-cross-compile:
325 name: linux-cross-compile
326 needs: prepare
327 uses: ./.github/workflows/build-cross-compile.yml
328 with:
329 gcc-major-version: '10'
330 configure-arguments: ${{ github.event.inputs.configure-arguments }}
331 make-arguments: ${{ github.event.inputs.make-arguments }}
332 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
333 if: needs.prepare.outputs.linux-cross-compile == 'true'
334
335 build-alpine-linux-x64:
336 name: alpine-linux-x64
337 needs: prepare
338 uses: ./.github/workflows/build-alpine-linux.yml
339 with:
340 platform: alpine-linux-x64
341 configure-arguments: ${{ github.event.inputs.configure-arguments }}
342 make-arguments: ${{ github.event.inputs.make-arguments }}
343 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
344 if: needs.prepare.outputs.alpine-linux-x64 == 'true'
345
346 build-macos-x64:
347 name: macos-x64
348 needs: prepare
349 uses: ./.github/workflows/build-macos.yml
350 with:
351 platform: macos-x64
352 runs-on: 'macos-15-intel'
353 xcode-toolset-version: '16.4'
354 configure-arguments: ${{ github.event.inputs.configure-arguments }}
355 make-arguments: ${{ github.event.inputs.make-arguments }}
356 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
357 if: needs.prepare.outputs.macos-x64 == 'true'
358
359 build-macos-aarch64:
360 name: macos-aarch64
361 needs: prepare
362 uses: ./.github/workflows/build-macos.yml
363 with:
364 platform: macos-aarch64
365 runs-on: 'macos-15'
366 xcode-toolset-version: '16.4'
367 configure-arguments: ${{ github.event.inputs.configure-arguments }}
368 make-arguments: ${{ github.event.inputs.make-arguments }}
369 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
370 if: needs.prepare.outputs.macos-aarch64 == 'true'
371
372 build-windows-x64:
373 name: windows-x64
374 needs: prepare
375 uses: ./.github/workflows/build-windows.yml
376 with:
377 platform: windows-x64
378 runs-on: windows-2022
379 msvc-toolset-version: '14.44'
380 msvc-toolset-architecture: 'x86.x64'
381 configure-arguments: ${{ github.event.inputs.configure-arguments }}
382 make-arguments: ${{ github.event.inputs.make-arguments }}
383 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
384 if: needs.prepare.outputs.windows-x64 == 'true'
385
386 build-windows-aarch64:
387 name: windows-aarch64
388 needs: prepare
389 uses: ./.github/workflows/build-windows.yml
390 with:
391 platform: windows-aarch64
392 runs-on: windows-2022
393 msvc-toolset-version: '14.44'
394 msvc-toolset-architecture: 'arm64'
395 make-target: 'hotspot'
396 extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
397 configure-arguments: ${{ github.event.inputs.configure-arguments }}
398 make-arguments: ${{ github.event.inputs.make-arguments }}
399 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
400 if: needs.prepare.outputs.windows-aarch64 == 'true'
401
402 build-docs:
403 name: docs
404 needs: prepare
405 uses: ./.github/workflows/build-linux.yml
406 with:
407 platform: linux-x64
408 debug-levels: '[ "debug" ]'
409 make-target: 'docs-jdk-bundles'
410 # Make sure we never try to make full docs, since that would require a
411 # build JDK, and we do not need the additional testing of the graphs.
412 extra-conf-options: '--disable-full-docs'
413 gcc-major-version: '10'
414 configure-arguments: ${{ github.event.inputs.configure-arguments }}
415 make-arguments: ${{ github.event.inputs.make-arguments }}
416 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
417 if: needs.prepare.outputs.docs == 'true'
418
419 ###
420 ### Test jobs
421 ###
422
423 test-linux-x64:
424 name: linux-x64
425 needs:
426 - prepare
427 - build-linux-x64
428 uses: ./.github/workflows/test.yml
429 with:
430 platform: linux-x64
431 bootjdk-platform: linux-x64
432 runs-on: ubuntu-24.04
433 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
434 debug-suffix: -debug
435
436 test-linux-x64-static:
437 name: linux-x64-static
438 needs:
439 - prepare
440 - build-linux-x64
441 - build-linux-x64-static
442 uses: ./.github/workflows/test.yml
443 with:
444 platform: linux-x64
445 bootjdk-platform: linux-x64
446 runs-on: ubuntu-24.04
447 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
448 static-suffix: "-static"
449
450 test-linux-aarch64:
451 name: linux-aarch64
452 needs:
453 - prepare
454 - build-linux-aarch64
455 uses: ./.github/workflows/test.yml
456 with:
457 platform: linux-aarch64
458 bootjdk-platform: linux-aarch64
459 runs-on: ubuntu-24.04-arm
460 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
461 debug-suffix: -debug
462
463 test-macos-aarch64:
464 name: macos-aarch64
465 needs:
466 - prepare
467 - build-macos-aarch64
468 uses: ./.github/workflows/test.yml
469 with:
470 platform: macos-aarch64
471 bootjdk-platform: macos-aarch64
472 runs-on: macos-15
473 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
474 xcode-toolset-version: '16.4'
475 debug-suffix: -debug
476
477 test-windows-x64:
478 name: windows-x64
479 needs:
480 - prepare
481 - build-windows-x64
482 uses: ./.github/workflows/test.yml
483 with:
484 platform: windows-x64
485 bootjdk-platform: windows-x64
486 runs-on: windows-2022
487 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
488 debug-suffix: -debug