1 #
 2 # Copyright (c) 2022, 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: 'Do build'
27 description: 'Build the JDK using make'
28 inputs:
29   make-target:
30     description: 'Make target(s)'
31     required: true
32   platform:
33     description: 'Platform name'
34     required: true
35   debug-suffix:
36     description: 'File name suffix denoting debug level, possibly empty'
37     required: false
38 
39 runs:
40   using: composite
41   steps:
42     - name: 'Build'
43       id: build
44       run: >
45         make LOG=info ${{ inputs.make-target }}
46         || bash ./.github/scripts/gen-build-failure-report.sh "$GITHUB_STEP_SUMMARY"
47       shell: bash
48 
49     - name: 'Check for failure'
50       id: check
51       run: |
52         # Check for failure marker file
53         build_dir="$(ls -d build/*)"
54         if [[ -e $build_dir/build-failure ]]; then
55           # Collect relevant log files
56           mkdir failure-logs
57           cp \
58               $build_dir/spec.gmk \
59               $build_dir/build.log \
60               $build_dir/configure.log \
61               $build_dir/make-support/failure-summary.log \
62               $build_dir/make-support/failure-logs/* \
63               failure-logs/ 2> /dev/null || true
64           echo 'failure=true' >> $GITHUB_OUTPUT
65         fi
66       shell: bash
67 
68     - name: 'Upload build logs'
69       uses: actions/upload-artifact@v3
70       with:
71         name: failure-logs-${{ inputs.platform }}${{ inputs.debug-suffix }}
72         path: failure-logs
73       if: steps.check.outputs.failure == 'true'
74 
75       # This is the best way I found to abort the job with an error message
76     - name: 'Notify about build failures'
77       uses: actions/github-script@v6
78       with:
79         script: core.setFailed('Build failed. See summary for details.')
80       if: steps.check.outputs.failure == 'true'