27
27
enable-stack : true
28
28
stack-version : ' latest'
29
29
30
- - name : Cache dependencies
31
- uses : actions/cache@v4
30
+ # Ask Stack to use system GHC instead of installing its own copy
31
+ - name : Use system GHC
32
+ run : |
33
+ stack config set system-ghc --global true
34
+
35
+ - name : Restore cached dependencies
36
+ uses : actions/cache/restore@v4
37
+ id : cache
32
38
with :
33
39
path : ~/.stack
34
40
key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
@@ -37,10 +43,19 @@ jobs:
37
43
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-
38
44
${{ runner.os }}-ghc-${{ matrix.ghc }}-
39
45
40
- # Ask Stack to use system GHC instead of installing its own copy
41
- - name : Use system GHC
42
- run : |
43
- stack config set system-ghc --global true
46
+ - name : Install dependencies
47
+ run : stack build --test --only-dependencies
48
+
49
+ # Cache dependencies already at this point, so that we do not have to
50
+ # rebuild them should the subsequent steps fail
51
+ - name : Save cached dependencies
52
+ uses : actions/cache/save@v4
53
+ # Trying to save over an existing cache gives distracting
54
+ # "Warning: Cache save failed." since they are immutable
55
+ if : ${{ steps.cache.outputs.cache-hit != 'true' }}
56
+ with :
57
+ path : ~/.stack
58
+ key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
44
59
45
60
- name : Test with Stack
46
61
run : |
@@ -95,8 +110,14 @@ jobs:
95
110
cabal v2-freeze
96
111
mv cabal.project.freeze frozen
97
112
98
- - name : Cache dependencies
99
- uses : actions/cache@v4
113
+ - name : Restore cached dependencies
114
+ uses : actions/cache/restore@v4
115
+ id : cache
116
+ env :
117
+ key :
118
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{
119
+ steps.setup-haskell.outputs.cabal-version }}${{
120
+ matrix.project-variant }}
100
121
with :
101
122
path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
102
123
key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
@@ -105,9 +126,23 @@ jobs:
105
126
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
106
127
${{ runner.os }}-ghc-${{ matrix.ghc }}-
107
128
129
+ - name : Install dependencies
130
+ run : cabal v2-build all --enable-tests --only-dependencies
131
+
132
+ # Cache dependencies already at this point, so that we do not have to
133
+ # rebuild them should the subsequent steps fail
134
+ - name : Save cached dependencies
135
+ uses : actions/cache/save@v4
136
+ # Trying to save over an existing cache gives distracting
137
+ # "Warning: Cache save failed." since they are immutable
138
+ if : ${{ steps.cache.outputs.cache-hit != 'true' }}
139
+ with :
140
+ path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
141
+ key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
142
+
108
143
- name : Build
109
144
run : |
110
- cabal build all --enable-tests
145
+ cabal v2- build all --enable-tests
111
146
112
147
- name : Test
113
148
run : |
0 commit comments