Skip to content

Commit 2eaa2a4

Browse files
Remove cabal.project.freeze files in workflows after computing the cache key (#2552)
* Enable tests for brittany and 9.0.2 * Enable tests for floskell plugin * Remove cabal.project.freeze * don't test Brittany for ghc-9.0.1 * restore src cache keys * restore src cache keys * remove freeze cache key Co-authored-by: Anton Latukha <anton.latukha@gmail.com>
1 parent 937fdd0 commit 2eaa2a4

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

.github/workflows/bench.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,26 @@ jobs:
8686
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
8787
8888
- name: Form the package list ('cabal.project.freeze')
89-
continue-on-error: true
89+
id: compute-cache-key
9090
run: |
9191
cabal v2-freeze && \
9292
echo '' && \
9393
echo 'Output:' && \
9494
echo '' && \
9595
cat 'cabal.project.freeze' && \
9696
echo '' || \
97-
echo 'WARNING: Could not produce the `freeze`.
97+
echo 'WARNING: Could not produce the `freeze`.'
98+
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
99+
# Removing freeze file as it can break builds using allow-newer
100+
rm -f cabal.project.freeze
98101
99102
- name: Hackage sources cache
100103
uses: actions/cache@v2
101104
env:
102105
cache-name: hackage-sources
103106
with:
104-
path: ${{ env.CABAL_PKGS_DIR }}
105-
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
107+
path: ${{ env.CABAL_PKGS_DIR }}
108+
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
106109
restore-keys: ${{ env.cache-name }}-
107110

108111
- name: Compiled deps cache
@@ -112,7 +115,7 @@ jobs:
112115
cache-name: compiled-deps
113116
with:
114117
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
115-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
118+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
116119
restore-keys: |
117120
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
118121
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-

.github/workflows/caching.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,18 @@ jobs:
143143
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
144144
145145
- name: Form the package list ('cabal.project.freeze')
146-
continue-on-error: true
146+
id: compute-cache-key
147147
run: |
148148
cabal v2-freeze && \
149149
echo '' && \
150150
echo 'Output:' && \
151151
echo '' && \
152152
cat 'cabal.project.freeze' && \
153153
echo '' || \
154-
echo 'WARNING: Could not produce the `freeze`.
154+
echo 'WARNING: Could not produce the `freeze`.'
155+
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
156+
# Removing freeze file as it can break builds using allow-newer
157+
rm -f cabal.project.freeze
155158
156159
# 2021-12-02: NOTE: Cabal Hackage source tree storage does not depend on OS or GHC really,
157160
# but can depend on `base`.
@@ -164,10 +167,8 @@ jobs:
164167
cache-name: hackage-sources
165168
with:
166169
path: ${{ env.CABAL_PKGS_DIR }}
167-
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
168-
restore-keys: |
169-
${{ env.cache-name }}-${{ env.INDEX_STATE }}-
170-
${{ env.cache-name }}-
170+
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
171+
restore-keys: ${{ env.cache-name }}-
171172

172173
- name: Compiled deps cache
173174
id: compiled-deps
@@ -176,7 +177,7 @@ jobs:
176177
cache-name: compiled-deps
177178
with:
178179
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
179-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
180+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
180181
restore-keys: |
181182
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
182183
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-

.github/workflows/test.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,27 @@ jobs:
146146
INDEX_STATE1=$(echo "$INDEX_STATE_ENTRY" | cut -d' ' -f2 | tr ':' '-')
147147
echo "INDEX_STATE=$INDEX_STATE1" >> $GITHUB_ENV
148148
149-
- name: Form the package list ('cabal.project.freeze')
150-
continue-on-error: true
149+
- name: Compute the cache key
150+
id: compute-cache-key
151151
run: |
152152
cabal v2-freeze && \
153153
echo '' && \
154154
echo 'Output:' && \
155155
echo '' && \
156156
cat 'cabal.project.freeze' && \
157157
echo '' || \
158-
echo 'WARNING: Could not produce the `freeze`.
158+
echo 'WARNING: Could not produce the `freeze`.'
159+
echo ::set-output name=value::${{ hashFiles('cabal.project.freeze') }}
160+
# Removing freeze file as it can break builds using allow-newer
161+
rm -rf cabal.project.freeze
159162
160163
- name: Hackage sources cache
161164
uses: actions/cache@v2
162165
env:
163166
cache-name: hackage-sources
164167
with:
165-
path: ${{ env.CABAL_PKGS_DIR }}
166-
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
168+
path: ${{ env.CABAL_PKGS_DIR }}
169+
key: ${{ env.cache-name }}-${{ env.INDEX_STATE }}
167170
restore-keys: ${{ env.cache-name }}-
168171

169172
- name: Compiled deps cache
@@ -173,7 +176,7 @@ jobs:
173176
cache-name: compiled-deps
174177
with:
175178
path: ${{ steps.HaskEnvSetup.outputs.cabal-store }}
176-
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ hashFiles('cabal.project.freeze') }}
179+
key: ${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-${{ steps.compute-cache-key.outputs.value }}
177180
restore-keys: |
178181
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.INDEX_STATE }}-
179182
${{ env.cache-name }}-${{ runner.os }}-${{ matrix.ghc }}-
@@ -229,6 +232,10 @@ jobs:
229232
name: Test hls-brittany-plugin
230233
run: cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || cabal test hls-brittany-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-brittany-plugin --test-options="$TEST_OPTS"
231234

235+
- if: matrix.test
236+
name: Test hls-floskell-plugin
237+
run: cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || cabal test hls-floskell-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-floskell-plugin --test-options="$TEST_OPTS"
238+
232239
- if: matrix.test
233240
name: Test hls-class-plugin
234241
run: cabal test hls-class-plugin --test-options="$TEST_OPTS" || cabal test hls-class-plugin --test-options="$TEST_OPTS" || LSP_TEST_LOG_COLOR=0 LSP_TEST_LOG_MESSAGES=true LSP_TEST_LOG_STDERR=true cabal test hls-class-plugin --test-options="$TEST_OPTS"

0 commit comments

Comments
 (0)