Skip to content

Commit 087e8a2

Browse files
committedFeb 11, 2025
8342988: GHA: Build JTReg in single step
Reviewed-by: sgehwolf, mbaesken Backport-of: 6e6f8b2f90e362ceb2d76e791cd6e58cf5d3ddbd
1 parent 7213c0d commit 087e8a2

File tree

3 files changed

+110
-55
lines changed

3 files changed

+110
-55
lines changed
 
+68
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

+5-29
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

+37-26
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 }}
@@ -67,7 +67,19 @@ jobs:
6767
windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
6868

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

124136
build-linux-x64:
125137
name: linux-x64
126-
needs: select
138+
needs: prepare
127139
uses: ./.github/workflows/build-linux.yml
128140
with:
129141
platform: linux-x64
130142
gcc-major-version: '10'
131143
configure-arguments: ${{ github.event.inputs.configure-arguments }}
132144
make-arguments: ${{ github.event.inputs.make-arguments }}
133-
if: needs.select.outputs.linux-x64 == 'true'
145+
if: needs.prepare.outputs.linux-x64 == 'true'
134146

135147
build-linux-x86-hs:
136148
name: linux-x86-hs
137-
needs: select
149+
needs: prepare
138150
uses: ./.github/workflows/build-linux.yml
139151
with:
140152
platform: linux-x86
@@ -148,11 +160,11 @@ jobs:
148160
extra-conf-options: '--with-target-bits=32'
149161
configure-arguments: ${{ github.event.inputs.configure-arguments }}
150162
make-arguments: ${{ github.event.inputs.make-arguments }}
151-
if: needs.select.outputs.linux-x86-hs == 'true'
163+
if: needs.prepare.outputs.linux-x86-hs == 'true'
152164

153165
build-linux-x64-hs-nopch:
154166
name: linux-x64-hs-nopch
155-
needs: select
167+
needs: prepare
156168
uses: ./.github/workflows/build-linux.yml
157169
with:
158170
platform: linux-x64
@@ -162,11 +174,11 @@ jobs:
162174
extra-conf-options: '--disable-precompiled-headers'
163175
configure-arguments: ${{ github.event.inputs.configure-arguments }}
164176
make-arguments: ${{ github.event.inputs.make-arguments }}
165-
if: needs.select.outputs.linux-x64-variants == 'true'
177+
if: needs.prepare.outputs.linux-x64-variants == 'true'
166178

167179
build-linux-x64-hs-zero:
168180
name: linux-x64-hs-zero
169-
needs: select
181+
needs: prepare
170182
uses: ./.github/workflows/build-linux.yml
171183
with:
172184
platform: linux-x64
@@ -176,11 +188,11 @@ jobs:
176188
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
177189
configure-arguments: ${{ github.event.inputs.configure-arguments }}
178190
make-arguments: ${{ github.event.inputs.make-arguments }}
179-
if: needs.select.outputs.linux-x64-variants == 'true'
191+
if: needs.prepare.outputs.linux-x64-variants == 'true'
180192

181193
build-linux-x64-hs-minimal:
182194
name: linux-x64-hs-minimal
183-
needs: select
195+
needs: prepare
184196
uses: ./.github/workflows/build-linux.yml
185197
with:
186198
platform: linux-x64
@@ -190,11 +202,11 @@ jobs:
190202
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
191203
configure-arguments: ${{ github.event.inputs.configure-arguments }}
192204
make-arguments: ${{ github.event.inputs.make-arguments }}
193-
if: needs.select.outputs.linux-x64-variants == 'true'
205+
if: needs.prepare.outputs.linux-x64-variants == 'true'
194206

195207
build-linux-x64-hs-optimized:
196208
name: linux-x64-hs-optimized
197-
needs: select
209+
needs: prepare
198210
uses: ./.github/workflows/build-linux.yml
199211
with:
200212
platform: linux-x64
@@ -205,58 +217,57 @@ jobs:
205217
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
206218
configure-arguments: ${{ github.event.inputs.configure-arguments }}
207219
make-arguments: ${{ github.event.inputs.make-arguments }}
208-
if: needs.select.outputs.linux-x64-variants == 'true'
220+
if: needs.prepare.outputs.linux-x64-variants == 'true'
209221

210222
build-linux-cross-compile:
211223
name: linux-cross-compile
212-
needs:
213-
- select
224+
needs: prepare
214225
uses: ./.github/workflows/build-cross-compile.yml
215226
with:
216227
gcc-major-version: '10'
217228
configure-arguments: ${{ github.event.inputs.configure-arguments }}
218229
make-arguments: ${{ github.event.inputs.make-arguments }}
219-
if: needs.select.outputs.linux-cross-compile == 'true'
230+
if: needs.prepare.outputs.linux-cross-compile == 'true'
220231

221232
build-macos-x64:
222233
name: macos-x64
223-
needs: select
234+
needs: prepare
224235
uses: ./.github/workflows/build-macos.yml
225236
with:
226237
platform: macos-x64
227238
runs-on: 'macos-13'
228239
xcode-toolset-version: '14.3.1'
229240
configure-arguments: ${{ github.event.inputs.configure-arguments }}
230241
make-arguments: ${{ github.event.inputs.make-arguments }}
231-
if: needs.select.outputs.macos-x64 == 'true'
242+
if: needs.prepare.outputs.macos-x64 == 'true'
232243

233244
build-macos-aarch64:
234245
name: macos-aarch64
235-
needs: select
246+
needs: prepare
236247
uses: ./.github/workflows/build-macos.yml
237248
with:
238249
platform: macos-aarch64
239250
runs-on: 'macos-14'
240251
xcode-toolset-version: '15.4'
241252
configure-arguments: ${{ github.event.inputs.configure-arguments }}
242253
make-arguments: ${{ github.event.inputs.make-arguments }}
243-
if: needs.select.outputs.macos-aarch64 == 'true'
254+
if: needs.prepare.outputs.macos-aarch64 == 'true'
244255

245256
build-windows-x64:
246257
name: windows-x64
247-
needs: select
258+
needs: prepare
248259
uses: ./.github/workflows/build-windows.yml
249260
with:
250261
platform: windows-x64
251262
msvc-toolset-version: '14.29'
252263
msvc-toolset-architecture: 'x86.x64'
253264
configure-arguments: ${{ github.event.inputs.configure-arguments }}
254265
make-arguments: ${{ github.event.inputs.make-arguments }}
255-
if: needs.select.outputs.windows-x64 == 'true'
266+
if: needs.prepare.outputs.windows-x64 == 'true'
256267

257268
build-windows-aarch64:
258269
name: windows-aarch64
259-
needs: select
270+
needs: prepare
260271
uses: ./.github/workflows/build-windows.yml
261272
with:
262273
platform: windows-aarch64
@@ -266,7 +277,7 @@ jobs:
266277
extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
267278
configure-arguments: ${{ github.event.inputs.configure-arguments }}
268279
make-arguments: ${{ github.event.inputs.make-arguments }}
269-
if: needs.select.outputs.windows-aarch64 == 'true'
280+
if: needs.prepare.outputs.windows-aarch64 == 'true'
270281

271282
###
272283
### Test jobs

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Feb 11, 2025

@openjdk-notifier[bot]
Please sign in to comment.