@@ -17,42 +17,48 @@ jobs:
1717 runs-on : windows-latest
1818 steps :
1919
20- - name : Determine stack root
20+ - name : 📥 Checkout repository
21+ uses : actions/checkout@v4
22+
23+ - name : 🏗 Install yq
24+ uses : frenck/action-setup-yq@v1
25+
26+ - name : Determine stack root and resolver
2127 # # 2023-11-21 https://github.com/commercialhaskell/stack/issues/6340
2228 # # Asking stack for the stack root unfortunately does not work
2329 # # if stack is not fully operational (meaning e.g. that GHC is installed)
2430 # # so we hardcode its location instead.
2531 run : |
2632 STACK_ROOT="C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows"
27- echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
33+ STACK_RESOLVER=$(yq .resolver stack.yaml)
34+ echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
35+ echo STACK_RESOLVER="${STACK_RESOLVER}" >> "${GITHUB_ENV}"
2836 # run: |
2937 # STACK_ROOT="$(stack --system-ghc --no-install-ghc path --stack-root || echo "C:/Users/runneradmin/AppData/Local/Programs/stack/x86_64-windows")"
3038 # echo "STACK_ROOT = ${STACK_ROOT}"
3139 # echo STACK_ROOT="${STACK_ROOT}" >> "${GITHUB_ENV}"
3240 # What about C:/Users/runneradmin/AppData/Roaming/stack ?
3341
34- - name : 📥 Checkout repository
35- uses : actions/checkout@v4
36-
3742 # things to be restored:
43+ # Include STACK_RESOLVER in cache key, otherwise caches accumulate build products for different resolvers.
3844
3945 - name : 💾 Restore cached stack global package db
4046 id : stack-global
4147 uses : actions/cache/restore@v3
4248 with :
4349 path : ${{ env.STACK_ROOT }}
44- key : ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }}
50+ key : ${{ runner.os }}-stack-resolver-${{ env.STACK_RESOLVER }}- global-${{ hashFiles('**.yaml') }}
4551 restore-keys : |
46- ${{ runner.os }}-stack-global
52+ ${{ runner.os }}-stack-resolver-${{ env.STACK_RESOLVER }}- global
4753
4854 - name : 💾 Restore cached .stack-work
4955 id : stack-work
5056 uses : actions/cache/restore@v3
5157 with :
5258 path : .stack-work
53- key : ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }}
59+ key : ${{ runner.os }}-stack-resolver-${{ env.STACK_RESOLVER }}- work-${{ hashFiles('**.yaml') }}
5460 restore-keys : |
55- ${{ runner.os }}-stack-work
61+ ${{ runner.os }}-stack-resolver-${{ env.STACK_RESOLVER }}- work
5662
5763 # actions
5864
0 commit comments