Skip to content

Commit 89ced1a

Browse files
committed
ci: reorganize jobs
1 parent 7e1f6b1 commit 89ced1a

File tree

3 files changed

+98
-135
lines changed

3 files changed

+98
-135
lines changed

.github/actions/prepare_env.yml

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

.github/workflows/pull_request.yml

Lines changed: 56 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,60 @@ on:
55
types: [opened, reopened, synchronize]
66

77
jobs:
8-
soundness:
9-
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
10-
with:
11-
# Not API stable package (yet)
12-
api_breakage_check_enabled: false
13-
# FIXME: Something is off with the format task and it gets "stuck", need to investigate
14-
format_check_enabled: false
15-
license_header_check_project_name: Swift.org
16-
17-
test-java:
18-
name: Java tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
19-
runs-on: ubuntu-latest
20-
strategy:
21-
fail-fast: true
22-
matrix:
23-
swift_version: ['6.0.2']
24-
os_version: ['jammy']
25-
jdk_vendor: ['Corretto']
26-
container:
27-
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
28-
env:
29-
JAVA_HOME: "/usr/lib/jvm/default-jdk"
30-
steps:
31-
- 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
69-
- 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
76-
77-
test-swift:
78-
name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
79-
runs-on: ubuntu-latest
80-
strategy:
81-
fail-fast: false
82-
matrix:
83-
# swift_version: ['nightly-main']
84-
swift_version: ['6.0.2']
85-
os_version: ['jammy']
86-
jdk_vendor: ['Corretto']
87-
container:
88-
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
89-
env:
90-
JAVA_HOME: "/usr/lib/jvm/default-jdk"
91-
steps:
92-
- 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
127-
run: "swift test"
8+
# soundness:
9+
# uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
10+
# with:
11+
# # Not API stable package (yet)
12+
# api_breakage_check_enabled: false
13+
# # FIXME: Something is off with the format task and it gets "stuck", need to investigate
14+
# format_check_enabled: false
15+
# license_header_check_project_name: Swift.org
16+
#
17+
# test-java:
18+
# name: Java tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
19+
# runs-on: ubuntu-latest
20+
# strategy:
21+
# fail-fast: true
22+
# matrix:
23+
# swift_version: ['6.0.2']
24+
# os_version: ['jammy']
25+
# jdk_vendor: ['Corretto']
26+
# container:
27+
# image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
28+
# env:
29+
# JAVA_HOME: "/usr/lib/jvm/default-jdk"
30+
# steps:
31+
# - uses: actions/checkout@v4
32+
# - name: Prepare CI Environment
33+
# uses: .github/actions/prepare_env
34+
# # run the actual build
35+
# - name: Gradle build
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
41+
#
42+
# test-swift:
43+
# name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
44+
# runs-on: ubuntu-latest
45+
# strategy:
46+
# fail-fast: false
47+
# matrix:
48+
# # swift_version: ['nightly-main']
49+
# swift_version: ['6.0.2']
50+
# os_version: ['jammy']
51+
# jdk_vendor: ['Corretto']
52+
# container:
53+
# image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
54+
# env:
55+
# JAVA_HOME: "/usr/lib/jvm/default-jdk"
56+
# steps:
57+
# - uses: actions/checkout@v4
58+
# - name: Prepare CI Environment
59+
# uses: /.github/actions/prepare_env
60+
# - name: Test Swift
61+
# run: "swift test"
12862

12963
verify-samples:
13064
name: Verify Samples (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
@@ -141,20 +75,8 @@ jobs:
14175
JAVA_HOME: "/usr/lib/jvm/default-jdk"
14276
steps:
14377
- 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'"
78+
- name: Prepare CI Environment
79+
uses: .github/actions/prepare_env
15880
- name: Verify Samples (All)
15981
run: .github/scripts/validate_samples.sh
16082
# 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)