Skip to content

Commit 19b40a2

Browse files
committed
GHA | add GHC patch version to the cache name
1 parent 9932726 commit 19b40a2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/haskell.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,12 @@ jobs:
120120
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[] | select(.style != "local") | .id' | sort | uniq > dependencies.txt
121121
122122
# Use a fresh cache each month
123-
- name: Store month number as environment variable used in cache version
124-
run: echo "MONTHNUM=$(date -u '+%m')" >> $GITHUB_ENV
123+
- name: Store month number and GHC version as environment variables used in cache version
124+
run: |
125+
cat <<EOF >> $GITHUB_ENV
126+
MONTHNUM=$(date -u '+%m')
127+
GHC=$(ghc --numeric-version)
128+
EOF
125129
126130
# From the dependency list we restore the cached dependencies.
127131
# We use the hash of `dependencies.txt` as part of the cache key because that will be stable
@@ -134,10 +138,10 @@ jobs:
134138
${{ steps.setup-haskell.outputs.cabal-store }}
135139
dist-newstyle
136140
key:
137-
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }}
141+
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ env.GHC }}-${{ env.MONTHNUM }}-${{ hashFiles('dependencies.txt') }}
138142
# try to restore previous cache from this month if there's no cache for the dependencies set
139143
restore-keys: |
140-
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ env.MONTHNUM }}-
144+
cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ env.GHC }}-${{ env.MONTHNUM }}-
141145
142146
# Now we install the dependencies. If the cache was found and restored in the previous step,
143147
# this should be a no-op, but if the cache key was not found we need to build stuff so we can
@@ -180,7 +184,7 @@ jobs:
180184
if: ${{ failure() }}
181185
uses: actions/upload-artifact@v4
182186
with:
183-
name: failed-test-workspaces-${{ matrix.sys.os }}-ghc${{ matrix.ghc }}-cabal${{ matrix.cabal }}.tgz
187+
name: failed-test-workspaces-${{ matrix.sys.os }}-ghc${{ env.GHC }}-cabal${{ matrix.cabal }}.tgz
184188
path: ${{ runner.temp }}/workspaces.tgz
185189

186190
- name: "Tar artifacts"
@@ -211,7 +215,7 @@ jobs:
211215
if: ${{ always() }}
212216
continue-on-error: true
213217
with:
214-
name: chairman-test-artifacts-${{ matrix.sys.os }}-${{ matrix.ghc }}
218+
name: chairman-test-artifacts-${{ matrix.sys.os }}-${{ env.GHC }}
215219
path: ${{ runner.temp }}/chairman/
216220

217221
# Uncomment the following back in for debugging. Remember to launch a `pwsh` from

0 commit comments

Comments
 (0)