commercialhaskell / commercialhaskell/stack

Blessed recipe how to use stack on github actions, in particular caching?

Open
#5,754 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

Is there a blessed documentation how to do caching with `stack` builds on GitHub Actions? If not, could we have one?

In particular, I wonder how to correctly cache stack builds from one run of the CI to another. The resources I queried recommend to restore the whole stack root (`.stack/`). I wonder whether this would overwrite parts that shouldn't be overwritten, in particular if `stack` was updated upstream in between. Note that for `cabal`, only the subdirectory `.cabal/store` is cached, not all of `.cabal/`.

For example, is the following workflow correct?
1. `stack update`
2. `stack build --dry-run`, generating lock file
3. restore `.stack/` if stack version and lock file have not changed in comparison with last run of CI
4. `stack build`

Context:
- https://github.com/agda/agda/issues/5887
- https://github.com/commercialhaskell/stack/issues/5567#issuecomment-1127286545

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.