Skip to content

Commit c2cec7f

Browse files
committed
ci: change how we install jdk on macos
1 parent 8842a5a commit c2cec7f

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

.github/actions/prepare_env/action.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ runs:
55
using: composite
66
steps:
77
- name: Install System Dependencies
8+
if: matrix.os_version == 'jammy'
89
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
910
shell: bash
11+
- name: Set up JDK ${{ matrix.jdk_version }}
12+
uses: actions/setup-java@v4
13+
with:
14+
java-version: ${{ matrix.jdk_version }}
15+
distribution: ${{ matrix.jdk_vendor }}
16+
cache: 'gradle'
1017
- name: Cache JDKs
1118
id: cache-jdk
19+
if: matrix.os_version == 'jammy'
1220
uses: actions/cache@v4
1321
continue-on-error: true
1422
with:
@@ -17,12 +25,9 @@ runs:
1725
restore-keys: |
1826
${{ runner.os }}-jdk-
1927
- name: Install JDK
20-
if: steps.cache-jdk.outputs.cache-hit != 'true'
28+
if: steps.cache-jdk.outputs.cache-hit != 'true' && matrix.os_version == 'jammy'
2129
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
2230
shell: bash
23-
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
24-
# - name: Install Untested Nightly Swift
25-
# run: "bash -xc './docker/install_untested_nightly_swift.sh'"
2631
- name: Cache local Gradle repository
2732
uses: actions/cache@v4
2833
continue-on-error: true
@@ -34,6 +39,7 @@ runs:
3439
restore-keys: |
3540
${{ runner.os }}-gradle-
3641
- name: Cache local SwiftPM repository
42+
if: matrix.os_version == 'jammy'
3743
uses: actions/cache@v4
3844
continue-on-error: true
3945
with:

.github/workflows/pull_request.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
matrix:
2323
swift_version: ['6.1.2']
2424
os_version: ['jammy']
25-
jdk_vendor: ['Corretto']
25+
jdk_vendor: ['corretto']
26+
jdk_version: ['24']
2627
container:
2728
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
2829
env:
@@ -47,7 +48,8 @@ jobs:
4748
matrix:
4849
swift_version: ['6.1.2']
4950
os_version: ['macos']
50-
jdk_vendor: ['Corretto']
51+
jdk_vendor: ['corretto']
52+
jdk_version: ['24']
5153
env:
5254
JAVA_HOME: "/usr/lib/jvm/default-jdk"
5355
SWIFT_JAVA_VERBOSE: true
@@ -70,7 +72,8 @@ jobs:
7072
matrix:
7173
swift_version: ['6.1.2']
7274
os_version: ['jammy']
73-
jdk_vendor: ['Corretto']
75+
jdk_vendor: ['corretto']
76+
jdk_version: ['24']
7477
container:
7578
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
7679
env:
@@ -93,7 +96,8 @@ jobs:
9396
matrix:
9497
swift_version: ['6.1.2']
9598
os_version: ['macos']
96-
jdk_vendor: ['Corretto']
99+
jdk_vendor: ['corretto']
100+
jdk_version: ['24']
97101
env:
98102
JAVA_HOME: "/usr/lib/jvm/default-jdk"
99103
SWIFT_JAVA_VERBOSE: true
@@ -114,7 +118,8 @@ jobs:
114118
matrix:
115119
swift_version: ['6.1.2']
116120
os_version: ['jammy']
117-
jdk_vendor: ['Corretto']
121+
jdk_vendor: ['corretto']
122+
jdk_version: ['24']
118123
sample_app: [
119124
'JavaDependencySampleApp',
120125
'JavaKitSampleApp',
@@ -142,7 +147,8 @@ jobs:
142147
matrix:
143148
swift_version: ['6.1.2']
144149
os_version: ['sequoia']
145-
jdk_vendor: ['Corretto']
150+
jdk_vendor: ['corretto']
151+
jdk_version: ['24']
146152
sample_app: [
147153
'JavaDependencySampleApp',
148154
'JavaKitSampleApp',

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ ENV LANGUAGE=en_US.UTF-8
2121
COPY install_jdk.sh .
2222

2323
# JDK dependency
24-
RUN bash -xc 'JDK_VENDOR=Corretto ./install_jdk.sh'
24+
RUN bash -xc 'JDK_VENDOR=corretto ./install_jdk.sh'
2525
ENV JAVA_HOME="/usr/lib/jvm/default-jdk"
2626
ENV PATH="$PATH:/usr/lib/jvm/default-jdk/bin"

docker/install_jdk.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ set -euo pipefail
1717
# We need JDK 24 because that's the supported version with latest FFM
1818
# However, we also need JDK 23 at most because Gradle does not support 24.
1919

20-
# Supported JDKs: Corretto
20+
# Supported JDKs: corretto
2121
if [ "$JDK_VENDOR" = "" ]; then
22-
declare -r JDK_VENDOR="Corretto"
22+
declare -r JDK_VENDOR="corretto"
2323
fi
2424

2525
apt-get update && apt-get install -y wget tree
@@ -33,7 +33,7 @@ download_and_install_jdk() {
3333

3434
echo "Installing $JDK_VENDOR JDK (${jdk_version})..."
3535

36-
if [ "$JDK_VENDOR" = 'Corretto' ]; then
36+
if [ "$JDK_VENDOR" = 'corretto' ]; then
3737
if [ "$(uname -m)" = 'aarch64' ]; then
3838
case "$jdk_version" in
3939
"21")

0 commit comments

Comments
 (0)