1 #
  2 # Copyright (c) 2022, 2024, 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       - master
 32       - pr/*
 33       - jdk*
 34   workflow_dispatch:
 35     inputs:
 36       platforms:
 37         description: 'Platform(s) to execute on (comma separated, e.g. "linux-x64, macos, aarch64")'
 38         required: true
 39         default: 'linux-x64, linux-x64-variants, linux-cross-compile, alpine-linux-x64, macos-x64, macos-aarch64, windows-x64, windows-aarch64, docs'
 40       configure-arguments:
 41         description: 'Additional configure arguments'
 42         required: false
 43       make-arguments:
 44         description: 'Additional make arguments'
 45         required: false
 46 
 47 concurrency:
 48   group: ${{ github.workflow }}-${{ github.ref }}
 49   cancel-in-progress: true
 50 
 51 jobs:
 52 
 53   ###
 54   ### Determine platforms to include
 55   ###
 56 
 57   prepare:
 58     name: 'Prepare the run'
 59     runs-on: ubuntu-22.04
 60     env:
 61       # List of platforms to exclude by default
 62       EXCLUDED_PLATFORMS: 'alpine-linux-x64'
 63     outputs:
 64       linux-x64: ${{ steps.include.outputs.linux-x64 }}
 65       linux-x64-variants: ${{ steps.include.outputs.linux-x64-variants }}
 66       linux-cross-compile: ${{ steps.include.outputs.linux-cross-compile }}
 67       alpine-linux-x64: ${{ steps.include.outputs.alpine-linux-x64 }}
 68       macos-x64: ${{ steps.include.outputs.macos-x64 }}
 69       macos-aarch64: ${{ steps.include.outputs.macos-aarch64 }}
 70       windows-x64: ${{ steps.include.outputs.windows-x64 }}
 71       windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
 72       docs: ${{ steps.include.outputs.docs }}
 73 
 74     steps:
 75       - name: 'Checkout the scripts'
 76         uses: actions/checkout@v4
 77         with:
 78           sparse-checkout: |
 79             .github
 80             make/conf/github-actions.conf
 81 
 82       - name: 'Build JTReg'
 83         id: jtreg
 84         uses: ./.github/actions/build-jtreg
 85 
 86       # TODO: Now that we are checking out the repo scripts, we can put the following code
 87       # into a separate file
 88       - name: 'Check what jobs to run'
 89         id: include
 90         run: |
 91           # Determine which platform jobs to run
 92 
 93           # Returns 'true' if the input platform list matches any of the platform monikers given as argument,
 94           # 'false' otherwise.
 95           # arg $1: platform name or names to look for
 96 
 97           # Convert EXCLUDED_PLATFORMS from a comma-separated string to an array
 98           IFS=',' read -r -a excluded_array <<< "$EXCLUDED_PLATFORMS"
 99 
100           function check_platform() {
101             if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
102               input='${{ github.event.inputs.platforms }}'
103             elif [[ $GITHUB_EVENT_NAME == push ]]; then
104               if [[ '${{ !secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/') }}' == 'false' ]]; then
105                 # If JDK_SUBMIT_FILTER is set, and this is not a "submit/" branch, don't run anything
106                 >&2 echo 'JDK_SUBMIT_FILTER is set and not a "submit/" branch'
107                 echo 'false'
108                 return
109               else
110                 input='${{ secrets.JDK_SUBMIT_PLATFORMS }}'
111               fi
112             fi
113 
114             normalized_input="$(echo ,$input, | tr -d ' ')"
115             if [[ "$normalized_input" == ",," ]]; then
116               # For an empty input, assume all platforms should run, except those in the EXCLUDED_PLATFORMS list
117               for excluded in "${excluded_array[@]}"; do
118                 if [[ "$1" == "$excluded" ]]; then
119                   echo 'false'
120                   return
121                 fi
122               done
123               echo 'true'
124               return
125             else
126               # Check for all acceptable platform names
127               for part in $* ; do
128                 if echo "$normalized_input" | grep -q -e ",$part," ; then
129                   echo 'true'
130                   return
131                 fi
132               done
133 
134               # If not explicitly included, check against the EXCLUDED_PLATFORMS list
135               for excluded in "${excluded_array[@]}"; do
136                 if [[ "$1" == "$excluded" ]]; then
137                   echo 'false'
138                   return
139                 fi
140               done
141             fi
142 
143             echo 'false'
144           }
145 
146           echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
147           echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
148           echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
149           echo "alpine-linux-x64=$(check_platform alpine-linux-x64 alpine-linux x64)" >> $GITHUB_OUTPUT
150           echo "macos-x64=$(check_platform macos-x64 macos x64)" >> $GITHUB_OUTPUT
151           echo "macos-aarch64=$(check_platform macos-aarch64 macos aarch64)" >> $GITHUB_OUTPUT
152           echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
153           echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
154           echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
155 
156   ###
157   ### Build jobs
158   ###
159 
160   build-linux-x64:
161     name: linux-x64
162     needs: prepare
163     uses: ./.github/workflows/build-linux.yml
164     with:
165       platform: linux-x64
166       gcc-major-version: '10'
167       configure-arguments: ${{ github.event.inputs.configure-arguments }}
168       make-arguments: ${{ github.event.inputs.make-arguments }}
169     if: needs.prepare.outputs.linux-x64 == 'true'
170 
171   build-linux-x64-hs-nopch:
172     name: linux-x64-hs-nopch
173     needs: prepare
174     uses: ./.github/workflows/build-linux.yml
175     with:
176       platform: linux-x64
177       make-target: 'hotspot'
178       debug-levels: '[ "debug" ]'
179       gcc-major-version: '10'
180       extra-conf-options: '--disable-precompiled-headers'
181       configure-arguments: ${{ github.event.inputs.configure-arguments }}
182       make-arguments: ${{ github.event.inputs.make-arguments }}
183     if: needs.prepare.outputs.linux-x64-variants == 'true'
184 
185   build-linux-x64-hs-zero:
186     name: linux-x64-hs-zero
187     needs: prepare
188     uses: ./.github/workflows/build-linux.yml
189     with:
190       platform: linux-x64
191       make-target: 'hotspot'
192       debug-levels: '[ "debug" ]'
193       gcc-major-version: '10'
194       extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
195       configure-arguments: ${{ github.event.inputs.configure-arguments }}
196       make-arguments: ${{ github.event.inputs.make-arguments }}
197     if: needs.prepare.outputs.linux-x64-variants == 'true'
198 
199   build-linux-x64-hs-minimal:
200     name: linux-x64-hs-minimal
201     needs: prepare
202     uses: ./.github/workflows/build-linux.yml
203     with:
204       platform: linux-x64
205       make-target: 'hotspot'
206       debug-levels: '[ "debug" ]'
207       gcc-major-version: '10'
208       extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
209       configure-arguments: ${{ github.event.inputs.configure-arguments }}
210       make-arguments: ${{ github.event.inputs.make-arguments }}
211     if: needs.prepare.outputs.linux-x64-variants == 'true'
212 
213   build-linux-x64-hs-optimized:
214     name: linux-x64-hs-optimized
215     needs: prepare
216     uses: ./.github/workflows/build-linux.yml
217     with:
218       platform: linux-x64
219       make-target: 'hotspot'
220       # Technically this is not the "debug" level, but we can't inject a new matrix state for just this job
221       debug-levels: '[ "debug" ]'
222       gcc-major-version: '10'
223       extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
224       configure-arguments: ${{ github.event.inputs.configure-arguments }}
225       make-arguments: ${{ github.event.inputs.make-arguments }}
226     if: needs.prepare.outputs.linux-x64-variants == 'true'
227 
228   build-linux-x64-static:
229     name: linux-x64-static
230     needs: prepare
231     uses: ./.github/workflows/build-linux.yml
232     with:
233       platform: linux-x64
234       make-target: 'static-jdk-bundles'
235       # There are issues with fastdebug static build in GHA due to space limit.
236       # Only do release build for now.
237       debug-levels: '[ "release" ]'
238       gcc-major-version: '10'
239       configure-arguments: ${{ github.event.inputs.configure-arguments }}
240       make-arguments: ${{ github.event.inputs.make-arguments }}
241       static-suffix: "-static"
242     if: needs.prepare.outputs.linux-x64 == 'true'
243 
244   build-linux-x64-static-libs:
245     name: linux-x64-static-libs
246     needs: prepare
247     uses: ./.github/workflows/build-linux.yml
248     with:
249       platform: linux-x64
250       make-target: 'static-libs-bundles'
251       # Only build static-libs-bundles for release builds.
252       # For debug builds, building static-libs often exceeds disk space.
253       debug-levels: '[ "release" ]'
254       gcc-major-version: '10'
255       configure-arguments: ${{ github.event.inputs.configure-arguments }}
256       make-arguments: ${{ github.event.inputs.make-arguments }}
257       # Upload static libs bundles separately to avoid interference with normal linux-x64 bundle.
258       # This bundle is not used by testing jobs, but downstreams use it to check that
259       # dependent projects, e.g. libgraal, builds fine.
260       bundle-suffix: "-static-libs"
261     if: needs.prepare.outputs.linux-x64-variants == 'true'
262 
263   build-linux-cross-compile:
264     name: linux-cross-compile
265     needs: prepare
266     uses: ./.github/workflows/build-cross-compile.yml
267     with:
268       gcc-major-version: '10'
269       configure-arguments: ${{ github.event.inputs.configure-arguments }}
270       make-arguments: ${{ github.event.inputs.make-arguments }}
271     if: needs.prepare.outputs.linux-cross-compile == 'true'
272 
273   build-alpine-linux-x64:
274     name: alpine-linux-x64
275     needs: prepare
276     uses: ./.github/workflows/build-alpine-linux.yml
277     with:
278       platform: alpine-linux-x64
279       configure-arguments: ${{ github.event.inputs.configure-arguments }}
280       make-arguments: ${{ github.event.inputs.make-arguments }}
281     if: needs.prepare.outputs.alpine-linux-x64 == 'true'
282 
283   build-macos-x64:
284     name: macos-x64
285     needs: prepare
286     uses: ./.github/workflows/build-macos.yml
287     with:
288       platform: macos-x64
289       runs-on: 'macos-13'
290       xcode-toolset-version: '14.3.1'
291       configure-arguments: ${{ github.event.inputs.configure-arguments }}
292       make-arguments: ${{ github.event.inputs.make-arguments }}
293     if: needs.prepare.outputs.macos-x64 == 'true'
294 
295   build-macos-aarch64:
296     name: macos-aarch64
297     needs: prepare
298     uses: ./.github/workflows/build-macos.yml
299     with:
300       platform: macos-aarch64
301       runs-on: 'macos-14'
302       xcode-toolset-version: '15.4'
303       configure-arguments: ${{ github.event.inputs.configure-arguments }}
304       make-arguments: ${{ github.event.inputs.make-arguments }}
305     if: needs.prepare.outputs.macos-aarch64 == 'true'
306 
307   build-windows-x64:
308     name: windows-x64
309     needs: prepare
310     uses: ./.github/workflows/build-windows.yml
311     with:
312       platform: windows-x64
313       msvc-toolset-version: '14.44'
314       msvc-toolset-architecture: 'x86.x64'
315       configure-arguments: ${{ github.event.inputs.configure-arguments }}
316       make-arguments: ${{ github.event.inputs.make-arguments }}
317     if: needs.prepare.outputs.windows-x64 == 'true'
318 
319   build-windows-aarch64:
320     name: windows-aarch64
321     needs: prepare
322     uses: ./.github/workflows/build-windows.yml
323     with:
324       platform: windows-aarch64
325       msvc-toolset-version: '14.44'
326       msvc-toolset-architecture: 'arm64'
327       make-target: 'hotspot'
328       extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
329       configure-arguments: ${{ github.event.inputs.configure-arguments }}
330       make-arguments: ${{ github.event.inputs.make-arguments }}
331     if: needs.prepare.outputs.windows-aarch64 == 'true'
332 
333   build-docs:
334     name: docs
335     needs: prepare
336     uses: ./.github/workflows/build-linux.yml
337     with:
338       platform: linux-x64
339       debug-levels: '[ "debug" ]'
340       make-target: 'docs-jdk-bundles'
341       # Make sure we never try to make full docs, since that would require a
342       # build JDK, and we do not need the additional testing of the graphs.
343       extra-conf-options: '--disable-full-docs'
344       gcc-major-version: '10'
345       configure-arguments: ${{ github.event.inputs.configure-arguments }}
346       make-arguments: ${{ github.event.inputs.make-arguments }}
347     if: needs.prepare.outputs.docs == 'true'
348 
349   ###
350   ### Test jobs
351   ###
352 
353   test-linux-x64:
354     name: linux-x64
355     needs:
356       - build-linux-x64
357     uses: ./.github/workflows/test.yml
358     with:
359       platform: linux-x64
360       bootjdk-platform: linux-x64
361       runs-on: ubuntu-22.04
362       debug-suffix: -debug
363 
364   test-linux-x64-static:
365     name: linux-x64-static
366     needs:
367       - build-linux-x64
368       - build-linux-x64-static
369     uses: ./.github/workflows/test.yml
370     with:
371       platform: linux-x64
372       bootjdk-platform: linux-x64
373       runs-on: ubuntu-22.04
374       static-suffix: "-static"
375 
376   test-macos-aarch64:
377     name: macos-aarch64
378     needs:
379       - build-macos-aarch64
380     uses: ./.github/workflows/test.yml
381     with:
382       platform: macos-aarch64
383       bootjdk-platform: macos-aarch64
384       runs-on: macos-14
385       xcode-toolset-version: '15.4'
386       debug-suffix: -debug
387 
388   test-windows-x64:
389     name: windows-x64
390     needs:
391       - build-windows-x64
392     uses: ./.github/workflows/test.yml
393     with:
394       platform: windows-x64
395       bootjdk-platform: windows-x64
396       runs-on: windows-2025
397       debug-suffix: -debug