Skip to content

Commit 2b7d42e

Browse files
committed
Add pantry cache
1 parent 49fa9c5 commit 2b7d42e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/stack.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,34 @@ jobs:
4545
- name: Updo
4646
run: GHC_VERSION=${{ matrix.vers.ghc }} STACKAGE_VERSION=${{ matrix.vers.stackage }} make -f project-files.mk stack.yaml
4747

48+
# Generate a file to cache dependencies.
49+
- name: build
50+
run: stack ls dependencies json | jq > stack-deps.json
51+
52+
- name: build
53+
run: stack test --no-run-tests --no-terminal --only-dependencies
54+
55+
- name: Restore cached dependency of Pantry (Stackage package index)
56+
uses: actions/cache/restore@v4
57+
id: pantry
58+
env:
59+
key: ghc-${{ steps.setup.outputs.ghc-version }}-stack-${{ steps.setup.outputs.stack-version }}
60+
with:
61+
path: ${{ steps.setup.outputs.stack-root }}/pantry
62+
key: ${{ env.key }}-plan-${{ hashFiles('stack-deps.json') }}
63+
restore-keys: ${{ env.key }}-
64+
65+
- name: Recompute Stackage package index (~/.stack/pantry)
66+
if: steps.pantry.outputs.cache-hit != 'true'
67+
run: stack update
68+
69+
- name: Save cached dependencies
70+
uses: actions/cache/save@v4
71+
if: steps.pantry.outputs.cache-hit != 'true'
72+
with:
73+
path: ${{ steps.setup.outputs.stack-root }}/pantry
74+
key: ${{ steps.cache.outputs.cache-primary-key }}
75+
4876
- name: build
4977
run: stack test --no-run-tests --no-terminal
5078

0 commit comments

Comments
 (0)