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: 'Build (linux)'
27
28 on:
29 workflow_call:
30 inputs:
31 platform:
32 required: true
33 type: string
34 extra-conf-options:
35 required: false
36 type: string
37 make-target:
38 required: false
39 type: string
40 default: 'product-bundles test-bundles'
41 debug-levels:
42 required: false
43 type: string
44 default: '[ "debug", "release" ]'
45 gcc-major-version:
46 required: true
47 type: string
48 gcc-package-suffix:
49 required: false
50 type: string
51 default: ''
52 apt-architecture:
53 required: false
54 type: string
55 apt-extra-packages:
56 required: false
57 type: string
58 configure-arguments:
59 required: false
60 type: string
61 make-arguments:
62 required: false
63 type: string
64 dry-run:
65 required: false
66 type: boolean
67 default: false
68 bundle-suffix:
69 required: false
70 type: string
71 static-suffix:
72 required: false
73 type: string
74
75 jobs:
76 build-linux:
77 name: build
78 runs-on: ubuntu-22.04
79
80 strategy:
81 fail-fast: false
82 matrix:
83 debug-level: ${{ fromJSON(inputs.debug-levels) }}
84
85 steps:
86 - name: 'Checkout the JDK source'
87 uses: actions/checkout@v4
88
89 - name: 'Get the BootJDK'
90 id: bootjdk
91 uses: ./.github/actions/get-bootjdk
92 with:
93 platform: linux-x64
94
95 - name: 'Get JTReg'
96 id: jtreg
97 uses: ./.github/actions/get-jtreg
98
99 - name: 'Get GTest'
100 id: gtest
101 uses: ./.github/actions/get-gtest
102
103 - name: 'Set architecture'
104 id: arch
105 run: |
106 # Set a proper suffix for packages if using a different architecture
107 if [[ '${{ inputs.apt-architecture }}' != '' ]]; then
108 echo 'suffix=:${{ inputs.apt-architecture }}' >> $GITHUB_OUTPUT
109 fi
110
111 # Upgrading apt to solve libc6 installation bugs, see JDK-8260460.
112 - name: 'Install toolchain and dependencies'
113 run: |
114 # Install dependencies using apt-get
115 if [[ '${{ inputs.apt-architecture }}' != '' ]]; then
116 sudo dpkg --add-architecture ${{ inputs.apt-architecture }}
117 fi
118 sudo apt-get update
119 sudo apt-get install --only-upgrade apt
120 sudo apt-get install gcc-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} g++-${{ inputs.gcc-major-version }}${{ inputs.gcc-package-suffix }} libxrandr-dev${{ steps.arch.outputs.suffix }} libxtst-dev${{ steps.arch.outputs.suffix }} libcups2-dev${{ steps.arch.outputs.suffix }} libasound2-dev${{ steps.arch.outputs.suffix }} ${{ inputs.apt-extra-packages }}
121 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ inputs.gcc-major-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ inputs.gcc-major-version }}
122
123 - name: 'Configure'
124 run: >
125 bash configure
126 --with-conf-name=${{ inputs.platform }}
127 ${{ matrix.debug-level == 'debug' && '--with-debug-level=fastdebug' || '' }}
128 --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
129 --with-boot-jdk=${{ steps.bootjdk.outputs.path }}
130 --with-jtreg=${{ steps.jtreg.outputs.path }}
131 --with-gtest=${{ steps.gtest.outputs.path }}
132 --with-zlib=system
133 --with-jmod-compress=zip-1
134 ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
135 echo "Dumping config.log:" &&
136 cat config.log &&
137 exit 1)
138
139 - name: 'Build'
140 id: build
141 uses: ./.github/actions/do-build
142 with:
143 make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
144 platform: ${{ inputs.platform }}
145 debug-suffix: "${{ matrix.debug-level == 'debug' && '-debug' || '' }}"
146 if: ${{ inputs.dry-run == false }}
147
148 - name: 'Upload bundles'
149 uses: ./.github/actions/upload-bundles
150 with:
151 platform: ${{ inputs.platform }}
152 debug-suffix: "${{ matrix.debug-level == 'debug' && '-debug' || '' }}"
153 bundle-suffix: ${{ inputs.bundle-suffix }}
154 static-suffix: ${{ inputs.static-suffix }}
155 if: ${{ inputs.dry-run == false }}