Skip to content

Commit 7f98e7a

Browse files
committed
ci: reorganize jobs
1 parent 54fcce7 commit 7f98e7a

File tree

3 files changed

+61
-92
lines changed

3 files changed

+61
-92
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Swift Java CI Env'
2+
description: 'Prepare the CI environment by installing Swift and selected JDK etc.'
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install System Dependencies
8+
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
9+
shell: bash
10+
- name: Cache JDK
11+
id: cache-jdk
12+
uses: actions/cache@v4
13+
continue-on-error: true
14+
with:
15+
path: /usr/lib/jvm/default-jdk/
16+
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
17+
restore-keys: |
18+
${{ runner.os }}-jdk-
19+
- name: Install JDK
20+
if: steps.cache-jdk.outputs.cache-hit != 'true'
21+
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
22+
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'"
26+
- name: Cache local Gradle repository
27+
uses: actions/cache@v4
28+
continue-on-error: true
29+
with:
30+
path: |
31+
/root/.gradle/caches
32+
/root/.gradle/wrapper
33+
key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
34+
restore-keys: |
35+
${{ runner.os }}-gradle-
36+
- name: Cache local SwiftPM repository
37+
uses: actions/cache@v4
38+
continue-on-error: true
39+
with:
40+
path: /__w/swift-java/swift-java/.build/checkouts
41+
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
42+
restore-keys: |
43+
${{ runner.os }}-swiftpm-cache
44+
${{ runner.os }}-swiftpm-

.github/workflows/pull_request.yml

Lines changed: 16 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: true
2222
matrix:
23+
# swift_version: ['nightly-main']
2324
swift_version: ['6.0.2']
2425
os_version: ['jammy']
2526
jdk_vendor: ['Corretto']
@@ -29,50 +30,14 @@ jobs:
2930
JAVA_HOME: "/usr/lib/jvm/default-jdk"
3031
steps:
3132
- uses: actions/checkout@v4
32-
- name: Install System Dependencies
33-
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
34-
- name: Cache JDK
35-
id: cache-jdk
36-
uses: actions/cache@v4
37-
continue-on-error: true
38-
with:
39-
path: /usr/lib/jvm/default-jdk/
40-
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
41-
restore-keys: |
42-
${{ runner.os }}-jdk-
43-
- name: Install JDK
44-
if: steps.cache-jdk.outputs.cache-hit != 'true'
45-
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
46-
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
47-
# - name: Install Untested Nightly Swift
48-
# run: "bash -xc './docker/install_untested_nightly_swift.sh'"
49-
- name: Cache local Gradle repository
50-
uses: actions/cache@v4
51-
continue-on-error: true
52-
with:
53-
path: |
54-
/root/.gradle/caches
55-
/root/.gradle/wrapper
56-
key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
57-
restore-keys: |
58-
${{ runner.os }}-gradle-
59-
- name: Cache local SwiftPM repository
60-
uses: actions/cache@v4
61-
continue-on-error: true
62-
with:
63-
path: /__w/swift-java/swift-java/.build/checkouts
64-
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
65-
restore-keys: |
66-
${{ runner.os }}-swiftpm-cache
67-
${{ runner.os }}-swiftpm-
68-
# run the actual build
33+
- name: Prepare CI Environment
34+
uses: ./.github/actions/prepare_env
6935
- name: Gradle build
70-
run: |
71-
./gradlew build -x test --no-daemon # just build
72-
./gradlew build --info --no-daemon
73-
- name: Gradle build (benchmarks)
74-
run: |
75-
./gradlew compileJmh --info --no-daemon
36+
run: ./gradlew build -x test # just build
37+
- name: Gradle check
38+
run: ./gradlew check --info
39+
- name: Gradle compile benchmarks
40+
run: ./gradlew compileJmh --info
7641

7742
test-swift:
7843
name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
@@ -90,40 +55,11 @@ jobs:
9055
JAVA_HOME: "/usr/lib/jvm/default-jdk"
9156
steps:
9257
- uses: actions/checkout@v4
93-
- name: Install System Dependencies
94-
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
95-
- name: Cache JDK
96-
id: cache-jdk
97-
uses: actions/cache@v4
98-
continue-on-error: true
99-
with:
100-
path: /usr/lib/jvm/default-jdk/
101-
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
102-
restore-keys: |
103-
${{ runner.os }}-jdk-
104-
- name: Install JDK
105-
if: steps.cache-jdk.outputs.cache-hit != 'true'
106-
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
107-
- name: Cache local Gradle repository
108-
uses: actions/cache@v4
109-
continue-on-error: true
110-
with:
111-
path: |
112-
/root/.gradle/caches
113-
/root/.gradle/wrapper
114-
key: ${{ runner.os }}-gradle-${{ hashFiles('*/*.gradle*', 'settings.gradle') }}
115-
restore-keys: |
116-
${{ runner.os }}-gradle-
117-
- name: Cache local SwiftPM repository
118-
uses: actions/cache@v4
119-
continue-on-error: true
120-
with:
121-
path: /__w/swift-java/swift-java/.build/checkouts
122-
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
123-
restore-keys: |
124-
${{ runner.os }}-swiftpm-cache
125-
${{ runner.os }}-swiftpm-
126-
- name: Test Swift
58+
- name: Prepare CI Environment
59+
uses: ./.github/actions/prepare_env
60+
- name: Swift Build
61+
run: "swift build --build-tests"
62+
- name: Swift Test
12763
run: "swift test"
12864

12965
verify-samples:
@@ -132,6 +68,7 @@ jobs:
13268
strategy:
13369
fail-fast: false
13470
matrix:
71+
# swift_version: ['nightly-main']
13572
swift_version: ['6.0.2']
13673
os_version: ['jammy']
13774
jdk_vendor: ['Corretto']
@@ -141,20 +78,8 @@ jobs:
14178
JAVA_HOME: "/usr/lib/jvm/default-jdk"
14279
steps:
14380
- uses: actions/checkout@v4
144-
- name: Install System Dependencies
145-
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
146-
- name: Cache JDK
147-
id: cache-jdk
148-
uses: actions/cache@v4
149-
continue-on-error: true
150-
with:
151-
path: /usr/lib/jvm/default-jdk/
152-
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
153-
restore-keys: |
154-
${{ runner.os }}-jdk-
155-
- name: Install JDK
156-
if: steps.cache-jdk.outputs.cache-hit != 'true'
157-
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
81+
- name: Prepare CI Environment
82+
uses: ./.github/actions/prepare_env
15883
- name: Verify Samples (All)
15984
run: .github/scripts/validate_samples.sh
16085
# TODO: Benchmark compile crashes in CI, enable when nightly toolchains in better shape.

Sources/JExtractSwift/Swift2Java.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ extension Logger.Level: ExpressibleByArgument {
107107

108108
func isDirectory(url: URL) -> Bool {
109109
var isDirectory: ObjCBool = false
110-
FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory)
110+
_ = FileManager.default.fileExists(atPath: url.path, isDirectory: &isDirectory)
111111
return isDirectory.boolValue
112112
}

0 commit comments

Comments
 (0)