Is your project publicly available? If you link to it, I can better understand your configuration.
Your code includes matrix.resolver
, which I assume is a Stackage lts-*
/ nightly-*
/ ghc-*
string. This makes me wonder how you are installing GHC and Stack. Perhaps you are not using haskell-actions/setup and are instead installing Stack and then letting Stack install GHC? Stack installs GHC into ~/.stack
, so this may be a significant factor of the cache size. If you are testing nightly
(which points to the latest nightly snapshot), then you may be accumulating every version of GHC that you have ever tested in the corresponding cache.
I use stack-${{ matrix.ghc }}.yaml
files instead. The matrix specifies the GHC versions to test. Each stack-${{ matrix.ghc }}.yaml
file has the Stack configuration, specifying the resolver.
Example stack-9.6.6.yaml
file:
resolver: lts-22.28
packages:
...
Example stack-9.8.2.yaml
file:
resolver: nightly-2024-07-09
packages:
...
Example stack-9.10.1.yaml
file:
resolver: ghc-9.10.1
packages:
...
extra-deps:
...
In the workflow, you can then use haskell-actions/setup to install both GHC and Stack. Every stack
command used must include the --system-ghc
option to prevent Stack from installing GHC into ~/.stack
.
I am not sure what you mean by âsplitting up the ~/.stack
path.â Perhaps you want to cache ~/.stack
separately from the .stack-work
directories? You can do this using multiple cache steps. Separate caches must of course have different keys.