Skip to content

Commit f8b0e6c

Browse files
committed
hide setup latest java behind common action
1 parent 229fe99 commit f8b0e6c

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

.github/actions/common/action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ inputs:
5151
free-space:
5252
description: Whether to aggressively free disk space on the runner
5353
default: 'false'
54-
setup-java:
55-
description: Setup java based on env.JAVA_VERSION variable
56-
default: 'true'
54+
setup-latest-java:
55+
description: Setup latest stable java version
56+
default: 'false'
5757
cache-key-prefix:
5858
description: Add a prefix to cache key
5959
default: ''
@@ -84,11 +84,18 @@ runs:
8484
check-for-updates: 'false'
8585
set-java-home: 'false'
8686
- name: Set up JDK
87-
if: ${{ inputs.setup-java == 'true' }}
87+
if: ${{ inputs.setup-latest-java == 'false' }}
8888
uses: actions/[email protected]
8989
with:
9090
distribution: ${{ env.JAVA_DISTRO }}
9191
java-version: ${{ env.JAVA_VERSION }}
92+
- name: Set up JDK ea-stable
93+
if: ${{ inputs.setup-latest-java == 'true' }}
94+
uses: oracle-actions/setup-java@v1
95+
with:
96+
website: jdk.java.net
97+
release: ea
98+
version: stable
9299
- name: Cache local Maven repository (read-write)
93100
if: ${{ inputs.maven-cache == 'read-write' }}
94101
uses: actions/[email protected]

.github/workflows/validate.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,12 @@ jobs:
102102
- uses: actions/checkout@v4
103103
with:
104104
ref: ${{ inputs.ref }}
105-
- name: Set up JDK ea-stable
106-
uses: oracle-actions/setup-java@v1
107-
with:
108-
website: jdk.java.net
109-
release: ea
110-
version: stable
111105
- uses: ./.github/actions/common
112106
with:
113107
build-cache: read-write
114108
maven-cache: read-write
115109
cache-key-prefix: ${{ env.CACHE-KEY-PREFIX }}
116-
setup-java: false
110+
setup-latest-java: true
117111
run: |
118112
mvn ${MVN_ARGS} --version
119113
mvn ${MVN_ARGS} build-cache:go-offline
@@ -138,16 +132,11 @@ jobs:
138132
- uses: actions/checkout@v4
139133
with:
140134
ref: ${{ inputs.ref }}
141-
- uses: oracle-actions/setup-java@v1
142-
with:
143-
website: jdk.java.net
144-
release: ea
145-
version: stable
146135
- uses: ./.github/actions/common
147136
with:
148137
build-cache: read-only
149138
cache-key-prefix: ${{ env.CACHE-KEY-PREFIX }}
150-
setup-java: false
139+
setup-latest-java: true
151140
test-artifact-name: tests-${{ matrix.moduleSet }}-${{ matrix.platform }}-latest-java
152141
run: |
153142
mvn --version

0 commit comments

Comments
 (0)