Skip to content

Commit 67045b1

Browse files
committed
CI: caching: add early termination
1 parent 22540be commit 67045b1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/caching.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ jobs:
130130
restore-keys: ${{ env.cache-name }}-
131131

132132
- name: Compiled deps cache
133+
id: compiled-deps
133134
uses: actions/cache@v2
134135
env:
135136
cache-name: compiled-deps
@@ -141,9 +142,12 @@ jobs:
141142
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
142143
${{ env.cache-name }}-${{ runner.os }}-
143144
144-
- run: cabal update
145+
- if: (! steps.compiled-deps.outputs.cache-hit)
146+
run: |
147+
cabal update
145148
146-
- name: Download all sources
149+
- if: (! steps.compiled-deps.outputs.cache-hit)
150+
name: Download all sources
147151
run: |
148152
cabal $cabalBuild --only-download
149153
@@ -152,7 +156,8 @@ jobs:
152156
# but to cache what can be cached, so step is fault tolerant & would always succseed.
153157
# 2021-12-11: NOTE: Building all targets, since
154158
# current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies`
155-
- name: Build all targets; try 3 times
159+
- if: (! steps.compiled-deps.outputs.cache-hit)
160+
name: Build all targets; try 3 times
156161
continue-on-error: true
157162
run: |
158163
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild

0 commit comments

Comments
 (0)