@@ -85,31 +85,30 @@ jobs:
85
85
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
86
86
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
87
87
88
+ # We have to restore package sources before `cabal update`
89
+ # cause it overwrites the hackage index with the cached one
90
+ - name : Hackage sources cache
91
+ uses : actions/cache@v2
92
+ env :
93
+ cache-name : hackage-sources
94
+ with :
95
+ path : ${{ env.CABAL_PKGS_DIR }}
96
+ key : ${{ env.cache-name }}-${{ env.INDEX_STATE }}
97
+ restore-keys : ${{ env.cache-name }}-
98
+
88
99
# To ensure we get the lastest hackage index and not relying on haskell action logic
100
+ # It has to be done before `cabal freeze` to make it aware of the new index
89
101
- run : cabal update
90
102
91
103
- name : Form the package list ('cabal.project.freeze')
92
- id : compute-cache-key
93
104
run : |
94
105
cabal v2-freeze && \
95
106
echo "" && \
96
107
echo 'Output:' && \
97
108
echo "" && \
98
109
cat 'cabal.project.freeze' && \
99
- echo "" || \
110
+ echo '' || \
100
111
echo 'WARNING: Could not produce the `freeze`.'
101
- echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
102
- # Removing freeze file as it breaks builds with alternative flags
103
- rm -rf cabal.project.freeze
104
-
105
- - name : Hackage sources cache
106
- uses : actions/cache@v2
107
- env :
108
- cache-name : hackage-sources
109
- with :
110
- path : ${{ env.CABAL_PKGS_DIR }}
111
- key : ${{ env.cache-name }}-${{ env.INDEX_STATE }}
112
- restore-keys : ${{ env.cache-name }}-
113
112
114
113
- name : Compiled deps cache
115
114
id : compiled-deps
@@ -118,12 +117,16 @@ jobs:
118
117
cache-name : compiled-deps
119
118
with :
120
119
path : ${{ steps.HaskEnvSetup.outputs.cabal-store }}
121
- key : ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
120
+ key : ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
122
121
restore-keys : |
123
122
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
124
123
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
125
124
${{ env.cache-name }}-${{ runner.os }}-
126
125
126
+ # Removing freeze file cause it breaks builds with alternative flags
127
+ - name : Remove freeze file
128
+ run : rm -f cabal.project.freeze
129
+
127
130
- name : Build `hls-graph` with flags
128
131
run : cabal v2-build hls-graph --flags="pedantic embed-files stm-stats"
129
132
0 commit comments