Skip to content

Commit 04bf3bc

Browse files
committed
Cache Cabal store across runs in Github Actions
Caching strategy has been taken from https://markkarpov.com/post/github-actions-for-haskell-ci.html which has kindly described the directories and keys to use for caching the Cabal store in GH actions.
1 parent 0fa12e4 commit 04bf3bc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/test.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ jobs:
5858
# Add the mingw64 bin directory to the PATH so cabal can find pkg-config & opus
5959
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
6060
61-
- name: Build the project
62-
# Use --enable-tests until https://github.com/haskell/cabal/issues/7883
63-
# is fixed, as otherwise build will solve dependencies without considering
64-
# the test-suite dependencies, and then the tests will fail.
65-
run: cabal build --enable-tests
61+
- name: Update cabal store
62+
run: cabal update
63+
64+
- name: Create a freeze file for the cache
65+
run: cabal freeze --enable-tests
66+
67+
- uses: actions/cache@v4
68+
with:
69+
path: |
70+
${{ steps.setup-haskell.outputs.cabal-store }}
71+
dist-newstyle
72+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
73+
restore-keys: |
74+
${{ runner.os }}-${{ matrix.ghc }}-
6675
6776
- name: Run the tests
6877
# Use --enable-tests until https://github.com/haskell/cabal/issues/7883

0 commit comments

Comments
 (0)