ci: Cache pantry (hackage metadata) separately

This further reduces our usage of cache storage by caching the metadata
only once per repo. Now the metadata cache is ~250MB and the individual
caches with built dependencies are ~5M each.

Related: https://github.com/xmonad/X11/pull/75
Related: https://github.com/xmonad/xmonad/issues/283
This commit is contained in:
Tomas Janousek 2021-03-29 11:39:49 +01:00
parent 9fce3805fc
commit cfe99998fc

View File

@ -43,14 +43,22 @@ jobs:
sudo apt install -y ghc-${{ matrix.ghc }}
echo /opt/ghc/${{ matrix.ghc }}/bin >> $GITHUB_PATH
- name: Cache Haskell package metadata
uses: actions/cache@v2
with:
path: ~/.stack/pantry
key: stack-pantry-${{ runner.os }}
- name: Cache Haskell dependencies
uses: actions/cache@v2
with:
path: ~/.stack
key: ${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('*.cabal') }}
path: |
~/.stack/*
!~/.stack/pantry
key: stack-${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('*.cabal') }}
restore-keys: |
${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }}-
${{ runner.os }}-${{ matrix.resolver }}-
stack-${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles('stack.yaml') }}-
stack-${{ runner.os }}-${{ matrix.resolver }}-
- name: Build and test
run: |