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,23 @@ 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 }}
59
+ restore-keys : |
60
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
61
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-
62
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-
44
63
45
64
- name : Test with Stack
46
65
run : |
@@ -95,8 +114,32 @@ jobs:
95
114
cabal v2-freeze
96
115
mv cabal.project.freeze frozen
97
116
98
- - name : Cache dependencies
99
- uses : actions/cache@v4
117
+ - name : Restore cached dependencies
118
+ uses : actions/cache/restore@v4
119
+ id : cache
120
+ env :
121
+ key :
122
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{
123
+ steps.setup-haskell.outputs.cabal-version }}${{
124
+ matrix.project-variant }}
125
+ with :
126
+ path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
127
+ key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
128
+ restore-keys : |
129
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
130
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
131
+ ${{ runner.os }}-ghc-${{ matrix.ghc }}-
132
+
133
+ - name : Install dependencies
134
+ run : cabal v2-build all --enable-tests --only-dependencies
135
+
136
+ # Cache dependencies already at this point, so that we do not have to
137
+ # rebuild them should the subsequent steps fail
138
+ - name : Save cached dependencies
139
+ uses : actions/cache/save@v3
140
+ # Trying to save over an existing cache gives distracting
141
+ # "Warning: Cache save failed." since they are immutable
142
+ if : ${{ steps.cache.outputs.cache-hit != 'true' }}
100
143
with :
101
144
path : ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
102
145
key : ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
@@ -107,7 +150,7 @@ jobs:
107
150
108
151
- name : Build
109
152
run : |
110
- cabal build all --enable-tests
153
+ cabal v2- build all --enable-tests
111
154
112
155
- name : Test
113
156
run : |
0 commit comments