Skip to content

freckle/stack-cache-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

373 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack Cache Action

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: false

You could consider replacing use of this action with that directly.

Usage

uses: freckle/stack-cache-action@v3

Behavior

  1. Restores/saves ~/.stack and all .stack-work directories, as determined by the location of .cabal and package.yaml files

  2. 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.

  3. Falls back to same resolver/dependencies, then same resolver (but no further)

Inputs

  • stack-yaml: Path to your stack.yaml file
  • working-directory: Useful in monorepositories
  • prefix: A prefix to include on keys; useful for cache busting or versioning

Further Reading

See https://tech.freckle.com/2021/05/18/haskell-on-actions/ for a short tutorial.

Acknowledgements

The idea and initial repository skeleton was taken from gha-yarn-cache.


LICENSE | CHANGELOG

About

One-line caching action for Stack-based Haskell projects

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors