Skip to content

Commit df89d7e

Browse files
authored
cache JDK, speedup downloads and CI time (#98)
1 parent bc54194 commit df89d7e

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.github/workflows/pull_request.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- name: Install System Dependencies
3232
run: apt-get -qq update && apt-get -qq install -y make curl wget
33+
- name: Cache JDK
34+
id: cache-jdk
35+
uses: actions/cache@v4
36+
continue-on-error: true
37+
with:
38+
path: /usr/lib/jvm/default-jdk/
39+
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
40+
restore-keys: |
41+
${{ runner.os }}-jdk-
3342
- name: Install JDK
43+
if: steps.cache-jdk.outputs.cache-hit != 'true'
3444
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
3545
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
3646
- name: Install Untested Nightly Swift
3747
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
38-
# setup caches
3948
- name: Cache local Gradle repository
4049
uses: actions/cache@v4
4150
continue-on-error: true
@@ -79,11 +88,21 @@ jobs:
7988
- uses: actions/checkout@v4
8089
- name: Install System Dependencies
8190
run: apt-get -qq update && apt-get -qq install -y make curl wget
91+
- name: Cache JDK
92+
id: cache-jdk
93+
uses: actions/cache@v4
94+
continue-on-error: true
95+
with:
96+
path: /usr/lib/jvm/default-jdk/
97+
key: ${{ runner.os }}-jdk-${{ matrix.jdk_vendor }}-${{ hashFiles('/usr/lib/jvm/default-jdk/*') }}
98+
restore-keys: |
99+
${{ runner.os }}-jdk-
82100
- name: Install JDK
101+
if: steps.cache-jdk.outputs.cache-hit != 'true'
83102
run: "bash -xc 'JDK_VENDOR=${{ matrix.jdk_vendor }} ./docker/install_jdk.sh'"
103+
# TODO: not using setup-java since incompatible with the swiftlang/swift base image
84104
- name: Install Untested Nightly Swift
85105
run: "bash -xc './docker/install_untested_nightly_swift.sh'"
86-
# setup caches
87106
- name: Cache local Gradle repository
88107
uses: actions/cache@v4
89108
continue-on-error: true

0 commit comments

Comments
 (0)