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-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-cross-compile: ${{ steps.include.outputs.linux-cross-compile }}
68 alpine-linux-x64: ${{ steps.include.outputs.alpine-linux-x64 }}
69 macos-x64: ${{ steps.include.outputs.macos-x64 }}
70 macos-aarch64: ${{ steps.include.outputs.macos-aarch64 }}
71 windows-x64: ${{ steps.include.outputs.windows-x64 }}
72 windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
73 docs: ${{ steps.include.outputs.docs }}
74 dry-run: ${{ steps.include.outputs.dry-run }}
75
76 steps:
77 - name: 'Checkout the scripts'
78 uses: actions/checkout@v4
79 with:
80 sparse-checkout: |
81 .github
82 make/conf/github-actions.conf
83
84 - name: 'Build JTReg'
85 id: jtreg
86 uses: ./.github/actions/build-jtreg
87
88 # TODO: Now that we are checking out the repo scripts, we can put the following code
89 # into a separate file
90 - name: 'Check what jobs to run'
91 id: include
92 run: |
93 # Determine which platform jobs to run
94
95 # Returns 'true' if the input platform list matches any of the platform monikers given as argument,
96 # 'false' otherwise.
97 # arg $1: platform name or names to look for
98
99 # Convert EXCLUDED_PLATFORMS from a comma-separated string to an array
100 IFS=',' read -r -a excluded_array <<< "$EXCLUDED_PLATFORMS"
101
102 function check_platform() {
103 if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
104 input='${{ github.event.inputs.platforms }}'
105 elif [[ $GITHUB_EVENT_NAME == push ]]; then
106 if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then
107 # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything
108 >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch'
109 echo 'false'
110 return
111 else
112 input='${{ secrets.JDK_SUBMIT_PLATFORMS }}'
113 fi
114 fi
115
116 normalized_input="$(echo ,$input, | tr -d ' ')"
117 if [[ "$normalized_input" == ",," ]]; then
118 # For an empty input, assume all platforms should run, except those in the EXCLUDED_PLATFORMS list
119 for excluded in "${excluded_array[@]}"; do
120 if [[ "$1" == "$excluded" ]]; then
121 echo 'false'
122 return
123 fi
124 done
125 echo 'true'
126 return
127 else
128 # Check for all acceptable platform names
129 for part in $* ; do
130 if echo "$normalized_input" | grep -q -e ",$part," ; then
131 echo 'true'
132 return
133 fi
134 done
135
136 # If not explicitly included, check against the EXCLUDED_PLATFORMS list
137 for excluded in "${excluded_array[@]}"; do
138 if [[ "$1" == "$excluded" ]]; then
139 echo 'false'
140 return
141 fi
142 done
143 fi
144
145 echo 'false'
146 }
147
148 function check_dry_run() {
149 if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
150 # Take the user-specified one.
151 echo '${{ github.event.inputs.dry-run }}'
152 return
153 elif [[ $GITHUB_EVENT_NAME == push ]]; then
154 # Cut out the real branch name
155 BRANCH=${GITHUB_REF##*/}
156
157 # Dry run rebuilds the caches in current branch, so they can be reused
158 # for any child PR branches. Because of this, we want to trigger this
159 # workflow in master branch, so that actual PR branches can use the cache.
160 # This workflow would trigger every time contributors sync their master
161 # branches in their personal forks.
162 if [[ $BRANCH == "master" ]]; then
163 echo 'true'
164 return
165 fi
166
167 # ...same for stabilization branches
168 if [[ $BRANCH =~ "jdk(.*)" ]]; then
169 echo 'true'
170 return
171 fi
172
173 # ...same for project branch
174 if [[ $BRANCH == "lworld" ]]; then
175 echo 'true'
176 return
177 fi
178 fi
179
180 echo 'false'
181 }
182
183 echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
184 echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
185 echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
186 echo "alpine-linux-x64=$(check_platform alpine-linux-x64 alpine-linux x64)" >> $GITHUB_OUTPUT
187 echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT
188 echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT
189 echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
190 echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
191 echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
192 echo "dry-run=$(check_dry_run)" >> $GITHUB_OUTPUT
193
194 ###
195 ### Build jobs
196 ###
197
198 build-linux-x64:
199 name: linux-x64
200 needs: prepare
201 uses: ./.github/workflows/build-linux.yml
202 with:
203 platform: linux-x64
204 gcc-major-version: '10'
205 configure-arguments: ${{ github.event.inputs.configure-arguments }}
206 make-arguments: ${{ github.event.inputs.make-arguments }}
207 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
208 if: needs.prepare.outputs.linux-x64 == 'true'
209
210 build-linux-x64-hs-nopch:
211 name: linux-x64-hs-nopch
212 needs: prepare
213 uses: ./.github/workflows/build-linux.yml
214 with:
215 platform: linux-x64
216 make-target: 'hotspot'
217 debug-levels: '[ "debug" ]'
218 gcc-major-version: '10'
219 extra-conf-options: '--disable-precompiled-headers'
220 configure-arguments: ${{ github.event.inputs.configure-arguments }}
221 make-arguments: ${{ github.event.inputs.make-arguments }}
222 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
223 if: needs.prepare.outputs.linux-x64-variants == 'true'
224
225 # build-linux-x64-hs-zero:
226 # name: linux-x64-hs-zero
227 # needs: prepare
228 # uses: ./.github/workflows/build-linux.yml
229 # with:
230 # platform: linux-x64
231 # make-target: 'hotspot'
232 # debug-levels: '[ "debug" ]'
233 # gcc-major-version: '10'
234 # extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
235 # configure-arguments: ${{ github.event.inputs.configure-arguments }}
236 # make-arguments: ${{ github.event.inputs.make-arguments }}
237 # dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
238 # if: needs.prepare.outputs.linux-x64-variants == 'true'
239
240 build-linux-x64-hs-minimal:
241 name: linux-x64-hs-minimal
242 needs: prepare
243 uses: ./.github/workflows/build-linux.yml
244 with:
245 platform: linux-x64
246 make-target: 'hotspot'
247 debug-levels: '[ "debug" ]'
248 gcc-major-version: '10'
249 extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
250 configure-arguments: ${{ github.event.inputs.configure-arguments }}
251 make-arguments: ${{ github.event.inputs.make-arguments }}
252 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
253 if: needs.prepare.outputs.linux-x64-variants == 'true'
254
255 build-linux-x64-hs-optimized:
256 name: linux-x64-hs-optimized
257 needs: prepare
258 uses: ./.github/workflows/build-linux.yml
259 with:
260 platform: linux-x64
261 make-target: 'hotspot'
262 # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
263 debug-levels: '[ "debug" ]'
264 gcc-major-version: '10'
265 extra-conf-options: '--with-debug-level=optimized --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-static:
272 name: linux-x64-static
273 needs: prepare
274 uses: ./.github/workflows/build-linux.yml
275 with:
276 platform: linux-x64
277 make-target: 'static-jdk-bundles'
278 # There are issues with fastdebug static build in GHA due to space limit.
279 # Only do release build for now.
280 debug-levels: '[ "release" ]'
281 gcc-major-version: '10'
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 static-suffix: "-static"
286 if: needs.prepare.outputs.linux-x64 == 'true'
287
288 build-linux-x64-static-libs:
289 name: linux-x64-static-libs
290 needs: prepare
291 uses: ./.github/workflows/build-linux.yml
292 with:
293 platform: linux-x64
294 make-target: 'static-libs-bundles'
295 # Only build static-libs-bundles for release builds.
296 # For debug builds, building static-libs often exceeds disk space.
297 debug-levels: '[ "release" ]'
298 gcc-major-version: '10'
299 configure-arguments: ${{ github.event.inputs.configure-arguments }}
300 make-arguments: ${{ github.event.inputs.make-arguments }}
301 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
302 # Upload static libs bundles separately to avoid interference with normal linux-x64 bundle.
303 # This bundle is not used by testing jobs, but downstreams use it to check that
304 # dependent projects, e.g. libgraal, builds fine.
305 bundle-suffix: "-static-libs"
306 if: needs.prepare.outputs.linux-x64-variants == 'true'
307
308 build-linux-cross-compile:
309 name: linux-cross-compile
310 needs: prepare
311 uses: ./.github/workflows/build-cross-compile.yml
312 with:
313 gcc-major-version: '10'
314 configure-arguments: ${{ github.event.inputs.configure-arguments }}
315 make-arguments: ${{ github.event.inputs.make-arguments }}
316 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
317 if: needs.prepare.outputs.linux-cross-compile == 'true'
318
319 build-alpine-linux-x64:
320 name: alpine-linux-x64
321 needs: prepare
322 uses: ./.github/workflows/build-alpine-linux.yml
323 with:
324 platform: alpine-linux-x64
325 configure-arguments: ${{ github.event.inputs.configure-arguments }}
326 make-arguments: ${{ github.event.inputs.make-arguments }}
327 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
328 if: needs.prepare.outputs.alpine-linux-x64 == 'true'
329
330 build-macos-x64:
331 name: macos-x64
332 needs: prepare
333 uses: ./.github/workflows/build-macos.yml
334 with:
335 platform: macos-x64
336 runs-on: 'macos-15-intel'
337 xcode-toolset-version: '16.4'
338 configure-arguments: ${{ github.event.inputs.configure-arguments }}
339 make-arguments: ${{ github.event.inputs.make-arguments }}
340 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
341 if: needs.prepare.outputs.macos-x64 == 'true'
342
343 build-macos-aarch64:
344 name: macos-aarch64
345 needs: prepare
346 uses: ./.github/workflows/build-macos.yml
347 with:
348 platform: macos-aarch64
349 runs-on: 'macos-15'
350 xcode-toolset-version: '16.4'
351 configure-arguments: ${{ github.event.inputs.configure-arguments }}
352 make-arguments: ${{ github.event.inputs.make-arguments }}
353 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
354 if: needs.prepare.outputs.macos-aarch64 == 'true'
355
356 build-windows-x64:
357 name: windows-x64
358 needs: prepare
359 uses: ./.github/workflows/build-windows.yml
360 with:
361 platform: windows-x64
362 msvc-toolset-version: '14.44'
363 msvc-toolset-architecture: 'x86.x64'
364 configure-arguments: ${{ github.event.inputs.configure-arguments }}
365 make-arguments: ${{ github.event.inputs.make-arguments }}
366 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
367 if: needs.prepare.outputs.windows-x64 == 'true'
368
369 build-windows-aarch64:
370 name: windows-aarch64
371 needs: prepare
372 uses: ./.github/workflows/build-windows.yml
373 with:
374 platform: windows-aarch64
375 msvc-toolset-version: '14.44'
376 msvc-toolset-architecture: 'arm64'
377 make-target: 'hotspot'
378 extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
379 configure-arguments: ${{ github.event.inputs.configure-arguments }}
380 make-arguments: ${{ github.event.inputs.make-arguments }}
381 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
382 if: needs.prepare.outputs.windows-aarch64 == 'true'
383
384 build-docs:
385 name: docs
386 needs: prepare
387 uses: ./.github/workflows/build-linux.yml
388 with:
389 platform: linux-x64
390 debug-levels: '[ "debug" ]'
391 make-target: 'docs-jdk-bundles'
392 # Make sure we never try to make full docs, since that would require a
393 # build JDK, and we do not need the additional testing of the graphs.
394 extra-conf-options: '--disable-full-docs'
395 gcc-major-version: '10'
396 configure-arguments: ${{ github.event.inputs.configure-arguments }}
397 make-arguments: ${{ github.event.inputs.make-arguments }}
398 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
399 if: needs.prepare.outputs.docs == 'true'
400
401 ###
402 ### Test jobs
403 ###
404
405 test-linux-x64:
406 name: linux-x64
407 needs:
408 - prepare
409 - build-linux-x64
410 uses: ./.github/workflows/test.yml
411 with:
412 platform: linux-x64
413 bootjdk-platform: linux-x64
414 runs-on: ubuntu-24.04
415 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
416 debug-suffix: -debug
417
418 test-linux-x64-static:
419 name: linux-x64-static
420 needs:
421 - prepare
422 - build-linux-x64
423 - build-linux-x64-static
424 uses: ./.github/workflows/test.yml
425 with:
426 platform: linux-x64
427 bootjdk-platform: linux-x64
428 runs-on: ubuntu-24.04
429 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
430 static-suffix: "-static"
431
432 test-macos-aarch64:
433 name: macos-aarch64
434 needs:
435 - prepare
436 - build-macos-aarch64
437 uses: ./.github/workflows/test.yml
438 with:
439 platform: macos-aarch64
440 bootjdk-platform: macos-aarch64
441 runs-on: macos-15
442 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
443 xcode-toolset-version: '16.4'
444 debug-suffix: -debug
445
446 test-windows-x64:
447 name: windows-x64
448 needs:
449 - prepare
450 - build-windows-x64
451 uses: ./.github/workflows/test.yml
452 with:
453 platform: windows-x64
454 bootjdk-platform: windows-x64
455 runs-on: windows-2025
456 dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
457 debug-suffix: -debug