Cache step for Stack-based Haskell projects on GitHub Actions.
NOTE: if you are using freckle/stack-action@v4 or newer, you do not
need this action as its own step. That version of that action handles all
caching internally, and better.
uses: freckle/stack-cache-action@v2-
Restores/saves
~/.stackand all.stack-workdirectories, as determined by the location of.cabalandpackage.yamlfiles -
Includes a hash of all source files in the cache key, so a new cache will be saved even if the dependencies haven't changed. This prevents re-compilation of un-changed modules in later builds.
-
Falls back to same resolver/dependencies, then same resolver (but no further)
stack-yaml: Path to yourstack.yamlfileworking-directory: Useful in monorepositoriesprefix: A prefix to include on keys; useful for cache busting or versioning
cache-hit: indicates a full cache hit on the primary key
See https://tech.freckle.com/2021/05/18/haskell-on-actions/ for a short tutorial.
The idea and initial repository skeleton was taken from gha-yarn-cache.