Skip to content

Commit 674df21

Browse files
committed
workflow experiment with building just once
1 parent bc54194 commit 674df21

File tree

1 file changed

+36
-19
lines changed

1 file changed

+36
-19
lines changed

.github/workflows/pull_request.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
format_check_enabled: false
1414
license_header_check_project_name: Swift.org
1515

16-
test-java:
17-
name: Java tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
16+
build:
17+
name: Build (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: true
@@ -35,7 +35,6 @@ jobs:
3535
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
3636
- name: Install Untested Nightly Swift
3737
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
38-
# setup caches
3938
- name: Cache local Gradle repository
4039
uses: actions/cache@v4
4140
continue-on-error: true
@@ -55,18 +54,16 @@ jobs:
5554
restore-keys: |
5655
${{ runner.os }}-swiftpm-cache
5756
${{ runner.os }}-swiftpm-
58-
# run the actual build
5957
- name: Gradle build
6058
run: |
6159
./gradlew build -x test --no-daemon # skip tests
62-
find .
63-
./gradlew build --info --no-daemon
6460
65-
test-swift:
66-
name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
61+
test-java:
62+
name: Java tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
6763
runs-on: ubuntu-latest
64+
needs: build
6865
strategy:
69-
fail-fast: false
66+
fail-fast: true
7067
matrix:
7168
swift_version: ['nightly-main']
7269
os_version: ['jammy']
@@ -77,13 +74,6 @@ jobs:
7774
JAVA_HOME: "/usr/lib/jvm/default-jdk"
7875
steps:
7976
- uses: actions/checkout@v4
80-
- name: Install System Dependencies
81-
run: apt-get -qq update && apt-get -qq install -y make curl wget
82-
- name: Install JDK
83-
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
84-
- name: Install Untested Nightly Swift
85-
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
86-
# setup caches
8777
- name: Cache local Gradle repository
8878
uses: actions/cache@v4
8979
continue-on-error: true
@@ -104,9 +94,36 @@ jobs:
10494
${{ runner.os }}-swiftpm-cache
10595
${{ runner.os }}-swiftpm-
10696
# run the actual build
107-
- name: Generate sources (make) (Temporary)
108-
# TODO: this should be triggered by the respective builds
109-
run: "make jextract-generate"
97+
- name: Gradle test
98+
run: |
99+
./gradlew build --info --no-daemon
100+
101+
test-swift:
102+
name: Swift tests (swift:${{ matrix.swift_version }} jdk:${{matrix.jdk_vendor}} os:${{ matrix.os_version }})
103+
runs-on: ubuntu-latest
104+
needs: build
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
swift_version: ['nightly-main']
109+
os_version: ['jammy']
110+
jdk_vendor: ['Corretto']
111+
container:
112+
image: ${{ (contains(matrix.swift_version, 'nightly') && 'swiftlang/swift') || 'swift' }}:${{ matrix.swift_version }}-${{ matrix.os_version }}
113+
env:
114+
JAVA_HOME: "/usr/lib/jvm/default-jdk"
115+
steps:
116+
- uses: actions/checkout@v4
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+
# run the actual build
110127
- name: Test Swift
111128
run: "swift test"
112129
- name: Build (Swift) Sample Apps

0 commit comments

Comments
 (0)