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