Skip to content

Commit fe68719

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

File tree

2 files changed

+55
-83
lines changed

2 files changed

+55
-83
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Swift Java CI Env'
2+
description: 'Prepare the CI environment by installind Swift and selected JDK etc.'
3+
inputs:
4+
swift_version:
5+
required: true
6+
type: string
7+
os_version:
8+
required: true
9+
type: string
10+
jdk_vendor:
11+
required: true
12+
type: string
13+
14+
runs:
15+
steps:
16+
- name: Install System Dependencies
17+
run: apt-get -qq update && apt-get -qq install -y make curl wget libjemalloc2 libjemalloc-dev
18+
- name: Cache JDK
19+
id: cache-jdk
20+
uses: actions/cache@v4
21+
continue-on-error: true
22+
with:
23+
path: /usr/lib/jvm/default-jdk/
24+
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
25+
restore-keys: |
26+
${{ runner.os }}-jdk-
27+
- name: Install JDK
28+
if: steps.cache-jdk.outputs.cache-hit != 'true'
29+
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
30+
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
31+
# - name: Install Untested Nightly Swift
32+
# run: "bash -xc './docker/install_untested_nightly_swift.sh'"
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-
43+
- name: Cache local SwiftPM repository
44+
uses: actions/cache@v4
45+
continue-on-error: true
46+
with:
47+
path: /__w/swift-java/swift-java/.build/checkouts
48+
key: ${{ runner.os }}-swiftpm-cache-${{ hashFiles('Package.swift') }}
49+
restore-keys: |
50+
${{ runner.os }}-swiftpm-cache
51+
${{ runner.os }}-swiftpm-

.github/workflows/pull_request.yml

Lines changed: 4 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,8 @@ jobs:
2929
JAVA_HOME: "/usr/lib/jvm/default-jdk"
3030
steps:
3131
- 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-
32+
- uses: swiftlang/swift-java/.github/workflows/prepare_env.yml@main
33+
6834
# run the actual build
6935
- name: Gradle build
7036
run: |
@@ -90,39 +56,7 @@ jobs:
9056
JAVA_HOME: "/usr/lib/jvm/default-jdk"
9157
steps:
9258
- 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-
59+
- uses: swiftlang/swift-java/.github/workflows/prepare_env.yml@main
12660
- name: Test Swift
12761
run: "swift test"
12862

@@ -141,20 +75,7 @@ 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+
- uses: swiftlang/swift-java/.github/workflows/prepare_env.yml@main
15879
- name: Verify Samples (All)
15980
run: .github/scripts/validate_samples.sh
16081
# TODO: Benchmark compile crashes in CI, enable when nightly toolchains in better shape.

0 commit comments

Comments
 (0)