Skip to content

Commit f954b6b

Browse files
committed
cleanup
1 parent ee62b16 commit f954b6b

File tree

3 files changed

+13
-39
lines changed

3 files changed

+13
-39
lines changed

.github/actions/prepare_env/action.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ description: 'Prepare the CI environment by installing Swift and selected JDK et
44
runs:
55
using: composite
66
steps:
7-
# - name: Install System Dependencies
8-
# if: matrix.os_version == 'jammy'
9-
# run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
10-
# shell: bash
117
- name: Set up JDK ${{ matrix.jdk_version }}
128
uses: actions/setup-java@v4
139
with:
@@ -16,30 +12,6 @@ runs:
1612
24
1713
21
1814
cache: 'gradle'
19-
# - name: Cache JDKs
20-
# id: cache-jdk
21-
# if: matrix.os_version == 'jammy'
22-
# uses: actions/cache@v4
23-
# continue-on-error: true
24-
# with:
25-
# path: /usr/lib/jvm/
26-
# key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/*') }}
27-
# restore-keys: |
28-
# ${{ runner.os }}-jdk-
29-
# - name: Install JDK
30-
# if: steps.cache-jdk.outputs.cache-hit != 'true' && matrix.os_version == 'jammy'
31-
# run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
32-
# shell: bash
33-
# - name: Cache local Gradle repository
34-
# uses: actions/cache@v4
35-
# continue-on-error: true
36-
# with:
37-
# path: |
38-
# /root/.gradle/caches
39-
# /root/.gradle/wrapper
40-
# key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
41-
# restore-keys: |
42-
# ${{ runner.os }}-gradle-
4315
- name: Cache local SwiftPM repository
4416
if: matrix.os_version == 'jammy'
4517
uses: actions/cache@v4

.github/workflows/pull_request.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
swift_version: ['6.1.2']
116116
os_version: ['jammy']
117117
jdk_vendor: ['corretto']
118-
sample_app: [
118+
sample_app: [ # TODO: use a reusable-workflow to generate those names
119119
'JavaDependencySampleApp',
120120
'JavaKitSampleApp',
121121
'JavaProbablyPrime',
@@ -131,7 +131,7 @@ jobs:
131131
- uses: actions/checkout@v4
132132
- name: Prepare CI Environment
133133
uses: ./.github/actions/prepare_env
134-
- name: "Verify sample"
134+
- name: "Verify sample: ${{ matrix.sample_app }}"
135135
run: .github/scripts/validate_sample.sh Samples/${{ matrix.sample_app }}
136136

137137
verify-samples-macos:
@@ -143,7 +143,7 @@ jobs:
143143
swift_version: ['6.1.2']
144144
os_version: ['macos']
145145
jdk_vendor: ['corretto']
146-
sample_app: [
146+
sample_app: [ # TODO: use a reusable-workflow to generate those names
147147
'JavaDependencySampleApp',
148148
'JavaKitSampleApp',
149149
'JavaProbablyPrime',
@@ -157,5 +157,5 @@ jobs:
157157
- uses: actions/checkout@v4
158158
- name: Prepare CI Environment
159159
uses: ./.github/actions/prepare_env
160-
- name: "Verify sample"
160+
- name: "Verify sample ${{ matrix.sample_app }}"
161161
run: .github/scripts/validate_sample.sh Samples/${{ matrix.sample_app }}

Samples/SwiftAndJavaJarSampleLib/ci-validate.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ set -x
66
./gradlew jar
77

88
SWIFT_VERSION="$(swift -version | awk '/Swift version/ { print $3 }')"
9+
ARCH=$(uname -m)
910

10-
# we make sure to build and run with JDK 24 because the runtime needs latest JDK, unlike Gradle which needed 21.
11-
if [ "$(uname -s)" = 'Darwin' ]
12-
then
13-
export OS='osx'
11+
if [ -n "$JAVA_HOME_24_$ARCH" ]; then
12+
export JAVA_HOME="$JAVA_HOME_24_$ARCH"
1413
elif [ "$(uname -s)" = 'Linux' ]
1514
then
16-
export OS='linux'
1715
export PATH="${PATH}:/usr/lib/jvm/jdk-24/bin" # we need to make sure to use the latest JDK to actually compile/run the executable
1816
fi
1917

@@ -24,8 +22,12 @@ MYLIB_CLASSPATH="$(pwd)/build/libs/*"
2422
CLASSPATH="$(pwd)/:${SWIFTKIT_CLASSPATH}:${MYLIB_CLASSPATH}"
2523
echo "CLASSPATH = ${CLASSPATH}"
2624

27-
javac -cp "${CLASSPATH}" Example.java
25+
JAVAC="${JAVA_HOME}/bin/javac"
26+
JAVA="${JAVA_HOME}/bin/java"
27+
28+
$JAVAC -cp "${CLASSPATH}" Example.java
2829

30+
# TODO: move all this into Gradle or SwiftPM and make it easier to get the right classpath for running
2931
if [ "$(uname -s)" = 'Linux' ]
3032
then
3133
SWIFT_LIB_PATHS=/usr/lib/swift/linux
@@ -50,7 +52,7 @@ fi
5052
echo "SWIFT_LIB_PATHS = ${SWIFT_LIB_PATHS}"
5153

5254
# Can we run the example?
53-
java --enable-native-access=ALL-UNNAMED \
55+
${JAVA} --enable-native-access=ALL-UNNAMED \
5456
-Djava.library.path="${SWIFT_LIB_PATHS}" \
5557
-cp "${CLASSPATH}" \
5658
Example

0 commit comments

Comments
 (0)