Skip to content

Commit 999c872

Browse files
committed
CI: caching: separate source retrieval step & separate build step
1 parent a4fce1f commit 999c872

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/caching.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ on:
3131
branches:
3232
- master
3333

34+
env:
35+
cabalBuild: "v2-build all --enable-tests --enable-benchmarks"
36+
3437
jobs:
3538

3639
pre_job:
@@ -128,6 +131,16 @@ jobs:
128131
129132
- run: cabal update
130133

134+
- name: Download all sources
135+
run: |
136+
cabal $cabalBuild --only-download
137+
131138
# repeating builds to workaround segfaults in windows and ghc-8.8.4
132-
- name: Build
133-
run: cabal build --only-dependencies || cabal build --only-dependencies || cabal build --only-dependencies
139+
# This build agenda in not to have successful code,
140+
# but to cache what can be cached, so step is fault tolerant & would always succseed.
141+
# 2021-12-11: NOTE: Building all targets, since
142+
# current Cabal does not allow `all --enable-tests --enable-benchmarks --only-dependencies`
143+
- name: Build all targets; try 3 times
144+
continue-on-error: true
145+
run: |
146+
cabal $cabalBuild || cabal $cabalBuild || cabal $cabalBuild

0 commit comments

Comments
 (0)