Skip to content

Commit ba5caa5

Browse files
committed
CI: caching: add early termination
1 parent 48f90dc commit ba5caa5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/caching.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ jobs:
139139
restore-keys: ${{ env.cache-name }}-
140140

141141
- name: Compiled deps cache
142+
id: compiled-deps
142143
uses: actions/cache@v2
143144
env:
144145
cache-name: compiled-deps
@@ -150,9 +151,12 @@ jobs:
150151
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
151152
${{ env.cache-name }}-${{ runner.os }}-
152153
153-
- run: cabal update
154+
- if: ! steps.compiled-deps.outputs.cache-hit
155+
run: |
156+
cabal update
154157
155-
- name: Download all sources
158+
- if: ! steps.compiled-deps.outputs.cache-hit
159+
name: Download all sources
156160
run: |
157161
cabal $cabalBuild --only-download
158162
@@ -161,7 +165,8 @@ jobs:
161165
# but to cache what can be cached, so step is fault tolerant & would always succseed.
162166
# 2021-12-11: NOTE: Building all targets, since
163167
# current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies`
164-
- name: Build all targets; try 3 times
168+
- if: ! steps.compiled-deps.outputs.cache-hit
169+
name: Build all targets; try 3 times
165170
continue-on-error: true
166171
run: |
167172
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild

0 commit comments

Comments
 (0)