Skip to content

Commit 6e6f8b2

Browse files
committed
8342988: GHA: Build JTReg in single step
Reviewed-by: serb, phh Backport-of: 88dc655a6d6cfc71c467405b62bd35beeed7794f
1 parent 0d8d8e6 commit 6e6f8b2

File tree

3 files changed

+112
-57
lines changed

3 files changed

+112
-57
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#
2+
# Copyright (c) 2023, 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 JTReg'
27+
description: 'Build JTReg'
28+
29+
runs:
30+
using: composite
31+
steps:
32+
- name: 'Get JTReg version configuration'
33+
id: version
34+
uses: ./.github/actions/config
35+
with:
36+
var: JTREG_VERSION
37+
38+
- name: 'Check cache for already built JTReg'
39+
id: get-cached
40+
uses: actions/cache@v4
41+
with:
42+
path: jtreg/installed
43+
key: jtreg-${{ steps.version.outputs.value }}
44+
45+
- name: 'Checkout the JTReg source'
46+
uses: actions/checkout@v4
47+
with:
48+
repository: openjdk/jtreg
49+
ref: jtreg-${{ steps.version.outputs.value }}
50+
path: jtreg/src
51+
if: (steps.get-cached.outputs.cache-hit != 'true')
52+
53+
- name: 'Build JTReg'
54+
run: |
55+
# Build JTReg and move files to the proper locations
56+
bash make/build.sh --jdk "$JAVA_HOME_17_X64"
57+
mkdir ../installed
58+
mv build/images/jtreg/* ../installed
59+
working-directory: jtreg/src
60+
shell: bash
61+
if: (steps.get-cached.outputs.cache-hit != 'true')
62+
63+
- name: 'Upload JTReg artifact'
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: bundles-jtreg-${{ steps.version.outputs.value }}
67+
path: jtreg/installed
68+
retention-days: 1

.github/actions/get-jtreg/action.yml

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#
2525

2626
name: 'Get JTReg'
27-
description: 'Download JTReg from cache or source location'
27+
description: 'Get JTReg'
2828
outputs:
2929
path:
3030
description: 'Path to the installed JTReg'
@@ -39,36 +39,12 @@ runs:
3939
with:
4040
var: JTREG_VERSION
4141

42-
- name: 'Check cache for JTReg'
43-
id: get-cached-jtreg
44-
uses: actions/cache@v4
42+
- name: 'Download JTReg artifact'
43+
id: download-jtreg
44+
uses: actions/download-artifact@v4
4545
with:
46+
name: bundles-jtreg-${{ steps.version.outputs.value }}
4647
path: jtreg/installed
47-
key: jtreg-${{ steps.version.outputs.value }}
48-
49-
- name: 'Checkout the JTReg source'
50-
uses: actions/checkout@v4
51-
with:
52-
repository: openjdk/jtreg
53-
ref: jtreg-${{ steps.version.outputs.value }}
54-
path: jtreg/src
55-
if: steps.get-cached-jtreg.outputs.cache-hit != 'true'
56-
57-
- name: 'Build JTReg'
58-
run: |
59-
# If runner architecture is x64 set JAVA_HOME_17_X64 otherwise set to JAVA_HOME_17_arm64
60-
if [[ '${{ runner.arch }}' == 'X64' ]]; then
61-
JDK="$JAVA_HOME_17_X64"
62-
else
63-
JDK="$JAVA_HOME_17_arm64"
64-
fi
65-
# Build JTReg and move files to the proper locations
66-
bash make/build.sh --jdk "$JDK"
67-
mkdir ../installed
68-
mv build/images/jtreg/* ../installed
69-
working-directory: jtreg/src
70-
shell: bash
71-
if: steps.get-cached-jtreg.outputs.cache-hit != 'true'
7248

7349
- name: 'Export path to where JTReg is installed'
7450
id: path-name

.github/workflows/main.yml

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ jobs:
5353
### Determine platforms to include
5454
###
5555

56-
select:
57-
name: 'Select platforms'
56+
prepare:
57+
name: 'Prepare the run'
5858
runs-on: ubuntu-22.04
5959
outputs:
6060
linux-x64: ${{ steps.include.outputs.linux-x64 }}
@@ -68,7 +68,19 @@ jobs:
6868
docs: ${{ steps.include.outputs.docs }}
6969

7070
steps:
71-
# This function must be inlined in main.yml, or we'd be forced to checkout the repo
71+
- name: 'Checkout the scripts'
72+
uses: actions/checkout@v4
73+
with:
74+
sparse-checkout: |
75+
.github
76+
make/conf/github-actions.conf
77+
78+
- name: 'Build JTReg'
79+
id: jtreg
80+
uses: ./.github/actions/build-jtreg
81+
82+
# TODO: Now that we are checking out the repo scripts, we can put the following code
83+
# into a separate file
7284
- name: 'Check what jobs to run'
7385
id: include
7486
run: |
@@ -125,18 +137,18 @@ jobs:
125137

126138
build-linux-x64:
127139
name: linux-x64
128-
needs: select
140+
needs: prepare
129141
uses: ./.github/workflows/build-linux.yml
130142
with:
131143
platform: linux-x64
132144
gcc-major-version: '10'
133145
configure-arguments: ${{ github.event.inputs.configure-arguments }}
134146
make-arguments: ${{ github.event.inputs.make-arguments }}
135-
if: needs.select.outputs.linux-x64 == 'true'
147+
if: needs.prepare.outputs.linux-x64 == 'true'
136148

137149
build-linux-x86-hs:
138150
name: linux-x86-hs
139-
needs: select
151+
needs: prepare
140152
uses: ./.github/workflows/build-linux.yml
141153
with:
142154
platform: linux-x86
@@ -150,11 +162,11 @@ jobs:
150162
extra-conf-options: '--with-target-bits=32'
151163
configure-arguments: ${{ github.event.inputs.configure-arguments }}
152164
make-arguments: ${{ github.event.inputs.make-arguments }}
153-
if: needs.select.outputs.linux-x86-hs == 'true'
165+
if: needs.prepare.outputs.linux-x86-hs == 'true'
154166

155167
build-linux-x64-hs-nopch:
156168
name: linux-x64-hs-nopch
157-
needs: select
169+
needs: prepare
158170
uses: ./.github/workflows/build-linux.yml
159171
with:
160172
platform: linux-x64
@@ -164,11 +176,11 @@ jobs:
164176
extra-conf-options: '--disable-precompiled-headers'
165177
configure-arguments: ${{ github.event.inputs.configure-arguments }}
166178
make-arguments: ${{ github.event.inputs.make-arguments }}
167-
if: needs.select.outputs.linux-x64-variants == 'true'
179+
if: needs.prepare.outputs.linux-x64-variants == 'true'
168180

169181
build-linux-x64-hs-zero:
170182
name: linux-x64-hs-zero
171-
needs: select
183+
needs: prepare
172184
uses: ./.github/workflows/build-linux.yml
173185
with:
174186
platform: linux-x64
@@ -178,11 +190,11 @@ jobs:
178190
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
179191
configure-arguments: ${{ github.event.inputs.configure-arguments }}
180192
make-arguments: ${{ github.event.inputs.make-arguments }}
181-
if: needs.select.outputs.linux-x64-variants == 'true'
193+
if: needs.prepare.outputs.linux-x64-variants == 'true'
182194

183195
build-linux-x64-hs-minimal:
184196
name: linux-x64-hs-minimal
185-
needs: select
197+
needs: prepare
186198
uses: ./.github/workflows/build-linux.yml
187199
with:
188200
platform: linux-x64
@@ -192,11 +204,11 @@ jobs:
192204
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
193205
configure-arguments: ${{ github.event.inputs.configure-arguments }}
194206
make-arguments: ${{ github.event.inputs.make-arguments }}
195-
if: needs.select.outputs.linux-x64-variants == 'true'
207+
if: needs.prepare.outputs.linux-x64-variants == 'true'
196208

197209
build-linux-x64-hs-optimized:
198210
name: linux-x64-hs-optimized
199-
needs: select
211+
needs: prepare
200212
uses: ./.github/workflows/build-linux.yml
201213
with:
202214
platform: linux-x64
@@ -207,58 +219,57 @@ jobs:
207219
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
208220
configure-arguments: ${{ github.event.inputs.configure-arguments }}
209221
make-arguments: ${{ github.event.inputs.make-arguments }}
210-
if: needs.select.outputs.linux-x64-variants == 'true'
222+
if: needs.prepare.outputs.linux-x64-variants == 'true'
211223

212224
build-linux-cross-compile:
213225
name: linux-cross-compile
214-
needs:
215-
- select
226+
needs: prepare
216227
uses: ./.github/workflows/build-cross-compile.yml
217228
with:
218229
gcc-major-version: '10'
219230
configure-arguments: ${{ github.event.inputs.configure-arguments }}
220231
make-arguments: ${{ github.event.inputs.make-arguments }}
221-
if: needs.select.outputs.linux-cross-compile == 'true'
232+
if: needs.prepare.outputs.linux-cross-compile == 'true'
222233

223234
build-macos-x64:
224235
name: macos-x64
225-
needs: select
236+
needs: prepare
226237
uses: ./.github/workflows/build-macos.yml
227238
with:
228239
platform: macos-x64
229240
runs-on: 'macos-13'
230241
xcode-toolset-version: '14.3.1'
231242
configure-arguments: ${{ github.event.inputs.configure-arguments }}
232243
make-arguments: ${{ github.event.inputs.make-arguments }}
233-
if: needs.select.outputs.macos-x64 == 'true'
244+
if: needs.prepare.outputs.macos-x64 == 'true'
234245

235246
build-macos-aarch64:
236247
name: macos-aarch64
237-
needs: select
248+
needs: prepare
238249
uses: ./.github/workflows/build-macos.yml
239250
with:
240251
platform: macos-aarch64
241252
runs-on: 'macos-14'
242253
xcode-toolset-version: '15.4'
243254
configure-arguments: ${{ github.event.inputs.configure-arguments }}
244255
make-arguments: ${{ github.event.inputs.make-arguments }}
245-
if: needs.select.outputs.macos-aarch64 == 'true'
256+
if: needs.prepare.outputs.macos-aarch64 == 'true'
246257

247258
build-windows-x64:
248259
name: windows-x64
249-
needs: select
260+
needs: prepare
250261
uses: ./.github/workflows/build-windows.yml
251262
with:
252263
platform: windows-x64
253264
msvc-toolset-version: '14.29'
254265
msvc-toolset-architecture: 'x86.x64'
255266
configure-arguments: ${{ github.event.inputs.configure-arguments }}
256267
make-arguments: ${{ github.event.inputs.make-arguments }}
257-
if: needs.select.outputs.windows-x64 == 'true'
268+
if: needs.prepare.outputs.windows-x64 == 'true'
258269

259270
build-windows-aarch64:
260271
name: windows-aarch64
261-
needs: select
272+
needs: prepare
262273
uses: ./.github/workflows/build-windows.yml
263274
with:
264275
platform: windows-aarch64
@@ -268,11 +279,11 @@ jobs:
268279
extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
269280
configure-arguments: ${{ github.event.inputs.configure-arguments }}
270281
make-arguments: ${{ github.event.inputs.make-arguments }}
271-
if: needs.select.outputs.windows-aarch64 == 'true'
282+
if: needs.prepare.outputs.windows-aarch64 == 'true'
272283

273284
build-docs:
274285
name: docs
275-
needs: select
286+
needs: prepare
276287
uses: ./.github/workflows/build-linux.yml
277288
with:
278289
platform: linux-x64
@@ -284,7 +295,7 @@ jobs:
284295
gcc-major-version: '10'
285296
configure-arguments: ${{ github.event.inputs.configure-arguments }}
286297
make-arguments: ${{ github.event.inputs.make-arguments }}
287-
if: needs.select.outputs.docs == 'true'
298+
if: needs.prepare.outputs.docs == 'true'
288299

289300
###
290301
### Test jobs

0 commit comments

Comments
 (0)