Cache step for Stack-based Haskell projects on GitHub Actions.
Note
As of @v3, this action is a composite pass-through to stack-action:
- uses: freckle/stack-action@v6
env:
STACK_YAML: ${{ inputs.stack-yaml }}
with:
working-directory: ${{ inputs.working-directory }}
cache-prefix: ${{ inputs.prefix }}
stack-build-arguments: --dry-run
install-stack: false
upgrade-stack: falseYou could consider replacing use of this action with that directly.
uses: freckle/stack-cache-action@v3-
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
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.