Skip to content

Commit 1fa772e

Browse files
committed
8343546: GHA: Cache required dependencies in master-branch workflow
Reviewed-by: ihse
1 parent 8ad4836 commit 1fa772e

File tree

7 files changed

+92
-3
lines changed

7 files changed

+92
-3
lines changed

.github/workflows/build-alpine-linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ on:
5151
make-arguments:
5252
required: false
5353
type: string
54+
dry-run:
55+
required: false
56+
type: boolean
57+
default: false
5458

5559
jobs:
5660
build-linux:
@@ -104,9 +108,11 @@ jobs:
104108
make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
105109
platform: ${{ inputs.platform }}
106110
debug-suffix: '${{ matrix.suffix }}'
111+
if: ${{ inputs.dry-run == false }}
107112

108113
- name: 'Upload bundles'
109114
uses: ./.github/actions/upload-bundles
110115
with:
111116
platform: ${{ inputs.platform }}
112117
debug-suffix: '${{ matrix.suffix }}'
118+
if: ${{ inputs.dry-run == false }}

.github/workflows/build-cross-compile.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ on:
4040
make-arguments:
4141
required: false
4242
type: string
43+
dry-run:
44+
required: false
45+
type: boolean
46+
default: false
4347

4448
jobs:
4549
build-cross-compile:
@@ -189,4 +193,4 @@ jobs:
189193
with:
190194
make-target: 'hotspot ${{ inputs.make-arguments }}'
191195
platform: linux-${{ matrix.target-cpu }}
192-
if: steps.create-sysroot.outcome == 'success' || steps.get-cached-sysroot.outputs.cache-hit == 'true'
196+
if: ((steps.create-sysroot.outcome == 'success' || steps.get-cached-sysroot.outputs.cache-hit == 'true') && inputs.dry-run == false)

.github/workflows/build-linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ on:
6161
make-arguments:
6262
required: false
6363
type: string
64+
dry-run:
65+
required: false
66+
type: boolean
67+
default: false
6468
bundle-suffix:
6569
required: false
6670
type: string
@@ -139,6 +143,7 @@ jobs:
139143
make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
140144
platform: ${{ inputs.platform }}
141145
debug-suffix: "${{ matrix.debug-level == 'debug' && '-debug' || '' }}"
146+
if: ${{ inputs.dry-run == false }}
142147

143148
- name: 'Upload bundles'
144149
uses: ./.github/actions/upload-bundles
@@ -147,3 +152,4 @@ jobs:
147152
debug-suffix: "${{ matrix.debug-level == 'debug' && '-debug' || '' }}"
148153
bundle-suffix: ${{ inputs.bundle-suffix }}
149154
static-suffix: ${{ inputs.static-suffix }}
155+
if: ${{ inputs.dry-run == false }}

.github/workflows/build-macos.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ on:
5454
make-arguments:
5555
required: false
5656
type: string
57+
dry-run:
58+
required: false
59+
type: boolean
60+
default: false
5761

5862
jobs:
5963
build-macos:
@@ -118,9 +122,11 @@ jobs:
118122
make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
119123
platform: ${{ inputs.platform }}
120124
debug-suffix: '${{ matrix.suffix }}'
125+
if: ${{ inputs.dry-run == false }}
121126

122127
- name: 'Upload bundles'
123128
uses: ./.github/actions/upload-bundles
124129
with:
125130
platform: ${{ inputs.platform }}
126131
debug-suffix: '${{ matrix.suffix }}'
132+
if: ${{ inputs.dry-run == false }}

.github/workflows/build-windows.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ on:
5454
make-arguments:
5555
required: false
5656
type: string
57+
dry-run:
58+
required: false
59+
type: boolean
60+
default: false
5761

5862
env:
5963
# These are needed to make the MSYS2 bash work properly
@@ -139,6 +143,7 @@ jobs:
139143
# Set PATH to "", so just GITHUB_PATH is included
140144
PATH: ''
141145
shell: env /usr/bin/bash --login -eo pipefail {0}
146+
if: ${{ inputs.dry-run == false }}
142147

143148
- name: 'Build'
144149
id: build
@@ -147,9 +152,11 @@ jobs:
147152
make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
148153
platform: ${{ inputs.platform }}
149154
debug-suffix: '${{ matrix.suffix }}'
155+
if: ${{ inputs.dry-run == false }}
150156

151157
- name: 'Upload bundles'
152158
uses: ./.github/actions/upload-bundles
153159
with:
154160
platform: ${{ inputs.platform }}
155161
debug-suffix: '${{ matrix.suffix }}'
162+
if: ${{ inputs.dry-run == false }}

.github/workflows/main.yml

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ name: 'OpenJDK GHA Sanity Checks'
2828
on:
2929
push:
3030
branches-ignore:
31-
- master
3231
- pr/*
33-
- jdk*
3432
workflow_dispatch:
3533
inputs:
3634
platforms:
@@ -43,6 +41,9 @@ on:
4341
make-arguments:
4442
description: 'Additional make arguments'
4543
required: false
44+
dry-run:
45+
description: 'Dry run: skip actual builds and tests'
46+
required: false
4647

4748
concurrency:
4849
group: ${{ github.workflow }}-${{ github.ref }}
@@ -70,6 +71,7 @@ jobs:
7071
windows-x64: ${{ steps.include.outputs.windows-x64 }}
7172
windows-aarch64: ${{ steps.include.outputs.windows-aarch64 }}
7273
docs: ${{ steps.include.outputs.docs }}
74+
dry-run: ${{ steps.include.outputs.dry-run }}
7375

7476
steps:
7577
- name: 'Checkout the scripts'
@@ -143,6 +145,35 @@ jobs:
143145
echo 'false'
144146
}
145147
148+
function check_dry_run() {
149+
if [[ $GITHUB_EVENT_NAME == workflow_dispatch ]]; then
150+
# Take the user-specified one.
151+
echo '${{ github.event.inputs.dry-run }}'
152+
return
153+
elif [[ $GITHUB_EVENT_NAME == push ]]; then
154+
# Cut out the real branch name
155+
BRANCH=${GITHUB_REF##*/}
156+
157+
# Dry run rebuilds the caches in current branch, so they can be reused
158+
# for any child PR branches. Because of this, we want to trigger this
159+
# workflow in master branch, so that actual PR branches can use the cache.
160+
# This workflow would trigger every time contributors sync their master
161+
# branches in their personal forks.
162+
if [[ $BRANCH == "master" ]]; then
163+
echo 'true'
164+
return
165+
fi
166+
167+
# ...same for stabilization branches
168+
if [[ $BRANCH =~ "jdk(.*)" ]]; then
169+
echo 'true'
170+
return
171+
fi
172+
fi
173+
174+
echo 'false'
175+
}
176+
146177
echo "linux-x64=$(check_platform linux-x64 linux x64)" >> $GITHUB_OUTPUT
147178
echo "linux-x64-variants=$(check_platform linux-x64-variants variants)" >> $GITHUB_OUTPUT
148179
echo "linux-cross-compile=$(check_platform linux-cross-compile cross-compile)" >> $GITHUB_OUTPUT
@@ -152,6 +183,7 @@ jobs:
152183
echo "windows-x64=$(check_platform windows-x64 windows x64)" >> $GITHUB_OUTPUT
153184
echo "windows-aarch64=$(check_platform windows-aarch64 windows aarch64)" >> $GITHUB_OUTPUT
154185
echo "docs=$(check_platform docs)" >> $GITHUB_OUTPUT
186+
echo "dry-run=$(check_dry_run)" >> $GITHUB_OUTPUT
155187
156188
###
157189
### Build jobs
@@ -166,6 +198,7 @@ jobs:
166198
gcc-major-version: '10'
167199
configure-arguments: ${{ github.event.inputs.configure-arguments }}
168200
make-arguments: ${{ github.event.inputs.make-arguments }}
201+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
169202
if: needs.prepare.outputs.linux-x64 == 'true'
170203

171204
build-linux-x64-hs-nopch:
@@ -180,6 +213,7 @@ jobs:
180213
extra-conf-options: '--disable-precompiled-headers'
181214
configure-arguments: ${{ github.event.inputs.configure-arguments }}
182215
make-arguments: ${{ github.event.inputs.make-arguments }}
216+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
183217
if: needs.prepare.outputs.linux-x64-variants == 'true'
184218

185219
build-linux-x64-hs-zero:
@@ -194,6 +228,7 @@ jobs:
194228
extra-conf-options: '--with-jvm-variants=zero --disable-precompiled-headers'
195229
configure-arguments: ${{ github.event.inputs.configure-arguments }}
196230
make-arguments: ${{ github.event.inputs.make-arguments }}
231+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
197232
if: needs.prepare.outputs.linux-x64-variants == 'true'
198233

199234
build-linux-x64-hs-minimal:
@@ -208,6 +243,7 @@ jobs:
208243
extra-conf-options: '--with-jvm-variants=minimal --disable-precompiled-headers'
209244
configure-arguments: ${{ github.event.inputs.configure-arguments }}
210245
make-arguments: ${{ github.event.inputs.make-arguments }}
246+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
211247
if: needs.prepare.outputs.linux-x64-variants == 'true'
212248

213249
build-linux-x64-hs-optimized:
@@ -223,6 +259,7 @@ jobs:
223259
extra-conf-options: '--with-debug-level=optimized --disable-precompiled-headers'
224260
configure-arguments: ${{ github.event.inputs.configure-arguments }}
225261
make-arguments: ${{ github.event.inputs.make-arguments }}
262+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
226263
if: needs.prepare.outputs.linux-x64-variants == 'true'
227264

228265
build-linux-x64-static:
@@ -238,6 +275,7 @@ jobs:
238275
gcc-major-version: '10'
239276
configure-arguments: ${{ github.event.inputs.configure-arguments }}
240277
make-arguments: ${{ github.event.inputs.make-arguments }}
278+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
241279
static-suffix: "-static"
242280
if: needs.prepare.outputs.linux-x64 == 'true'
243281

@@ -254,6 +292,7 @@ jobs:
254292
gcc-major-version: '10'
255293
configure-arguments: ${{ github.event.inputs.configure-arguments }}
256294
make-arguments: ${{ github.event.inputs.make-arguments }}
295+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
257296
# Upload static libs bundles separately to avoid interference with normal linux-x64 bundle.
258297
# This bundle is not used by testing jobs, but downstreams use it to check that
259298
# dependent projects, e.g. libgraal, builds fine.
@@ -268,6 +307,7 @@ jobs:
268307
gcc-major-version: '10'
269308
configure-arguments: ${{ github.event.inputs.configure-arguments }}
270309
make-arguments: ${{ github.event.inputs.make-arguments }}
310+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
271311
if: needs.prepare.outputs.linux-cross-compile == 'true'
272312

273313
build-alpine-linux-x64:
@@ -278,6 +318,7 @@ jobs:
278318
platform: alpine-linux-x64
279319
configure-arguments: ${{ github.event.inputs.configure-arguments }}
280320
make-arguments: ${{ github.event.inputs.make-arguments }}
321+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
281322
if: needs.prepare.outputs.alpine-linux-x64 == 'true'
282323

283324
build-macos-x64:
@@ -290,6 +331,7 @@ jobs:
290331
xcode-toolset-version: '14.3.1'
291332
configure-arguments: ${{ github.event.inputs.configure-arguments }}
292333
make-arguments: ${{ github.event.inputs.make-arguments }}
334+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
293335
if: needs.prepare.outputs.macos-x64 == 'true'
294336

295337
build-macos-aarch64:
@@ -302,6 +344,7 @@ jobs:
302344
xcode-toolset-version: '15.4'
303345
configure-arguments: ${{ github.event.inputs.configure-arguments }}
304346
make-arguments: ${{ github.event.inputs.make-arguments }}
347+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
305348
if: needs.prepare.outputs.macos-aarch64 == 'true'
306349

307350
build-windows-x64:
@@ -314,6 +357,7 @@ jobs:
314357
msvc-toolset-architecture: 'x86.x64'
315358
configure-arguments: ${{ github.event.inputs.configure-arguments }}
316359
make-arguments: ${{ github.event.inputs.make-arguments }}
360+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
317361
if: needs.prepare.outputs.windows-x64 == 'true'
318362

319363
build-windows-aarch64:
@@ -328,6 +372,7 @@ jobs:
328372
extra-conf-options: '--openjdk-target=aarch64-unknown-cygwin'
329373
configure-arguments: ${{ github.event.inputs.configure-arguments }}
330374
make-arguments: ${{ github.event.inputs.make-arguments }}
375+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
331376
if: needs.prepare.outputs.windows-aarch64 == 'true'
332377

333378
build-docs:
@@ -344,6 +389,7 @@ jobs:
344389
gcc-major-version: '10'
345390
configure-arguments: ${{ github.event.inputs.configure-arguments }}
346391
make-arguments: ${{ github.event.inputs.make-arguments }}
392+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
347393
if: needs.prepare.outputs.docs == 'true'
348394

349395
###
@@ -353,45 +399,53 @@ jobs:
353399
test-linux-x64:
354400
name: linux-x64
355401
needs:
402+
- prepare
356403
- build-linux-x64
357404
uses: ./.github/workflows/test.yml
358405
with:
359406
platform: linux-x64
360407
bootjdk-platform: linux-x64
361408
runs-on: ubuntu-22.04
409+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
362410
debug-suffix: -debug
363411

364412
test-linux-x64-static:
365413
name: linux-x64-static
366414
needs:
415+
- prepare
367416
- build-linux-x64
368417
- build-linux-x64-static
369418
uses: ./.github/workflows/test.yml
370419
with:
371420
platform: linux-x64
372421
bootjdk-platform: linux-x64
373422
runs-on: ubuntu-22.04
423+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
374424
static-suffix: "-static"
375425

376426
test-macos-aarch64:
377427
name: macos-aarch64
378428
needs:
429+
- prepare
379430
- build-macos-aarch64
380431
uses: ./.github/workflows/test.yml
381432
with:
382433
platform: macos-aarch64
383434
bootjdk-platform: macos-aarch64
384435
runs-on: macos-14
436+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
385437
xcode-toolset-version: '15.4'
386438
debug-suffix: -debug
387439

388440
test-windows-x64:
389441
name: windows-x64
390442
needs:
443+
- prepare
391444
- build-windows-x64
392445
uses: ./.github/workflows/test.yml
393446
with:
394447
platform: windows-x64
395448
bootjdk-platform: windows-x64
396449
runs-on: windows-2025
450+
dry-run: ${{ needs.prepare.outputs.dry-run == 'true' }}
397451
debug-suffix: -debug

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ on:
4040
xcode-toolset-version:
4141
required: false
4242
type: string
43+
dry-run:
44+
required: false
45+
type: boolean
46+
default: false
4347
debug-suffix:
4448
required: false
4549
type: string
@@ -147,6 +151,7 @@ jobs:
147151
platform: ${{ inputs.platform }}
148152
debug-suffix: ${{ matrix.debug-suffix }}
149153
static-suffix: ${{ inputs.static-suffix }}
154+
if: ${{ inputs.dry-run == false }}
150155

151156
- name: 'Install dependencies'
152157
run: |
@@ -199,6 +204,7 @@ jobs:
199204
&& bash ./.github/scripts/gen-test-summary.sh "$GITHUB_STEP_SUMMARY" "$GITHUB_OUTPUT"
200205
env:
201206
PATH: ${{ steps.path.outputs.value }}
207+
if: ${{ inputs.dry-run == false }}
202208

203209
# This is a separate step, since if the markdown from a step gets bigger than
204210
# 1024 kB it is skipped, but then the short summary above is still generated

0 commit comments

Comments
 (0)