Skip to content

Commit 88dc655

Browse files
committed
8342988: GHA: Build JTReg in single step
Reviewed-by: ihse
1 parent df3473e commit 88dc655

File tree

3 files changed

+114
-59
lines changed

3 files changed

+114
-59
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: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ jobs:
5454
### Determine platforms to include
5555
###
5656

57-
select:
58-
name: 'Select platforms'
57+
prepare:
58+
name: 'Prepare the run'
5959
runs-on: ubuntu-22.04
6060
env:
6161
# List of platforms to exclude by default
@@ -73,7 +73,19 @@ jobs:
7373
docs: ${{ steps.include.outputs.docs }}
7474

7575
steps:
76-
# This function must be inlined in main.yml, or we'd be forced to checkout the repo
76+
- name: 'Checkout the scripts'
77+
uses: actions/checkout@v4
78+
with:
79+
sparse-checkout: |
80+
.github
81+
make/conf/github-actions.conf
82+
83+
- name: 'Build JTReg'
84+
id: jtreg
85+
uses: ./.github/actions/build-jtreg
86+
87+
# TODO: Now that we are checking out the repo scripts, we can put the following code
88+
# into a separate file
7789
- name: 'Check what jobs to run'
7890
id: include
7991
run: |
@@ -149,18 +161,18 @@ jobs:
149161

150162
build-linux-x64:
151163
name: linux-x64
152-
needs: select
164+
needs: prepare
153165
uses: ./.github/workflows/build-linux.yml
154166
with:
155167
platform: linux-x64
156168
gcc-major-version: '10'
157169
configure-arguments: ${{ github.event.inputs.configure-arguments }}
158170
make-arguments: ${{ github.event.inputs.make-arguments }}
159-
if: needs.select.outputs.linux-x64 == 'true'
171+
if: needs.prepare.outputs.linux-x64 == 'true'
160172

161173
build-linux-x86-hs:
162174
name: linux-x86-hs
163-
needs: select
175+
needs: prepare
164176
uses: ./.github/workflows/build-linux.yml
165177
with:
166178
platform: linux-x86
@@ -174,11 +186,11 @@ jobs:
174186
extra-conf-options: '--with-target-bits=32 --enable-fallback-linker --enable-libffi-bundling'
175187
configure-arguments: ${{ github.event.inputs.configure-arguments }}
176188
make-arguments: ${{ github.event.inputs.make-arguments }}
177-
if: needs.select.outputs.linux-x86-hs == 'true'
189+
if: needs.prepare.outputs.linux-x86-hs == 'true'
178190

179191
build-linux-x64-hs-nopch:
180192
name: linux-x64-hs-nopch
181-
needs: select
193+
needs: prepare
182194
uses: ./.github/workflows/build-linux.yml
183195
with:
184196
platform: linux-x64
@@ -188,11 +200,11 @@ jobs:
188200
extra-conf-options: '--disable-precompiled-headers'
189201
configure-arguments: ${{ github.event.inputs.configure-arguments }}
190202
make-arguments: ${{ github.event.inputs.make-arguments }}
191-
if: needs.select.outputs.linux-x64-variants == 'true'
203+
if: needs.prepare.outputs.linux-x64-variants == 'true'
192204

193205
build-linux-x64-hs-zero:
194206
name: linux-x64-hs-zero
195-
needs: select
207+
needs: prepare
196208
uses: ./.github/workflows/build-linux.yml
197209
with:
198210
platform: linux-x64
@@ -202,11 +214,11 @@ jobs:
202214
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
203215
configure-arguments: ${{ github.event.inputs.configure-arguments }}
204216
make-arguments: ${{ github.event.inputs.make-arguments }}
205-
if: needs.select.outputs.linux-x64-variants == 'true'
217+
if: needs.prepare.outputs.linux-x64-variants == 'true'
206218

207219
build-linux-x64-hs-minimal:
208220
name: linux-x64-hs-minimal
209-
needs: select
221+
needs: prepare
210222
uses: ./.github/workflows/build-linux.yml
211223
with:
212224
platform: linux-x64
@@ -216,11 +228,11 @@ jobs:
216228
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
217229
configure-arguments: ${{ github.event.inputs.configure-arguments }}
218230
make-arguments: ${{ github.event.inputs.make-arguments }}
219-
if: needs.select.outputs.linux-x64-variants == 'true'
231+
if: needs.prepare.outputs.linux-x64-variants == 'true'
220232

221233
build-linux-x64-hs-optimized:
222234
name: linux-x64-hs-optimized
223-
needs: select
235+
needs: prepare
224236
uses: ./.github/workflows/build-linux.yml
225237
with:
226238
platform: linux-x64
@@ -231,68 +243,67 @@ jobs:
231243
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
232244
configure-arguments: ${{ github.event.inputs.configure-arguments }}
233245
make-arguments: ${{ github.event.inputs.make-arguments }}
234-
if: needs.select.outputs.linux-x64-variants == 'true'
246+
if: needs.prepare.outputs.linux-x64-variants == 'true'
235247

236248
build-linux-cross-compile:
237249
name: linux-cross-compile
238-
needs:
239-
- select
250+
needs: prepare
240251
uses: ./.github/workflows/build-cross-compile.yml
241252
with:
242253
gcc-major-version: '10'
243254
configure-arguments: ${{ github.event.inputs.configure-arguments }}
244255
make-arguments: ${{ github.event.inputs.make-arguments }}
245-
if: needs.select.outputs.linux-cross-compile == 'true'
256+
if: needs.prepare.outputs.linux-cross-compile == 'true'
246257

247258
build-alpine-linux-x64:
248259
name: alpine-linux-x64
249-
needs: select
260+
needs: prepare
250261
uses: ./.github/workflows/build-alpine-linux.yml
251262
with:
252263
platform: alpine-linux-x64
253264
configure-arguments: ${{ github.event.inputs.configure-arguments }}
254265
make-arguments: ${{ github.event.inputs.make-arguments }}
255-
if: needs.select.outputs.alpine-linux-x64 == 'true'
266+
if: needs.prepare.outputs.alpine-linux-x64 == 'true'
256267

257268
build-macos-x64:
258269
name: macos-x64
259-
needs: select
270+
needs: prepare
260271
uses: ./.github/workflows/build-macos.yml
261272
with:
262273
platform: macos-x64
263274
runs-on: 'macos-13'
264275
xcode-toolset-version: '14.3.1'
265276
configure-arguments: ${{ github.event.inputs.configure-arguments }}
266277
make-arguments: ${{ github.event.inputs.make-arguments }}
267-
if: needs.select.outputs.macos-x64 == 'true'
278+
if: needs.prepare.outputs.macos-x64 == 'true'
268279

269280
build-macos-aarch64:
270281
name: macos-aarch64
271-
needs: select
282+
needs: prepare
272283
uses: ./.github/workflows/build-macos.yml
273284
with:
274285
platform: macos-aarch64
275286
runs-on: 'macos-14'
276287
xcode-toolset-version: '14.3.1'
277288
configure-arguments: ${{ github.event.inputs.configure-arguments }}
278289
make-arguments: ${{ github.event.inputs.make-arguments }}
279-
if: needs.select.outputs.macos-aarch64 == 'true'
290+
if: needs.prepare.outputs.macos-aarch64 == 'true'
280291

281292
build-windows-x64:
282293
name: windows-x64
283-
needs: select
294+
needs: prepare
284295
uses: ./.github/workflows/build-windows.yml
285296
with:
286297
platform: windows-x64
287298
msvc-toolset-version: '14.29'
288299
msvc-toolset-architecture: 'x86.x64'
289300
configure-arguments: ${{ github.event.inputs.configure-arguments }}
290301
make-arguments: ${{ github.event.inputs.make-arguments }}
291-
if: needs.select.outputs.windows-x64 == 'true'
302+
if: needs.prepare.outputs.windows-x64 == 'true'
292303

293304
build-windows-aarch64:
294305
name: windows-aarch64
295-
needs: select
306+
needs: prepare
296307
uses: ./.github/workflows/build-windows.yml
297308
with:
298309
platform: windows-aarch64
@@ -302,11 +313,11 @@ jobs:
302313
extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
303314
configure-arguments: ${{ github.event.inputs.configure-arguments }}
304315
make-arguments: ${{ github.event.inputs.make-arguments }}
305-
if: needs.select.outputs.windows-aarch64 == 'true'
316+
if: needs.prepare.outputs.windows-aarch64 == 'true'
306317

307318
build-docs:
308319
name: docs
309-
needs: select
320+
needs: prepare
310321
uses: ./.github/workflows/build-linux.yml
311322
with:
312323
platform: linux-x64
@@ -318,7 +329,7 @@ jobs:
318329
gcc-major-version: '10'
319330
configure-arguments: ${{ github.event.inputs.configure-arguments }}
320331
make-arguments: ${{ github.event.inputs.make-arguments }}
321-
if: needs.select.outputs.docs == 'true'
332+
if: needs.prepare.outputs.docs == 'true'
322333

323334
###
324335
### Test jobs

0 commit comments

Comments
 (0)