Replace checksum key with full source digest

Checksumming stack.yaml was a cargo-cult of interpreted languages, where
"build" artifacts are uniquely determined by the dependency lock file.

This approach would result in us refusing to store a new cache after
changing code (as long as it was the same resolver), and forever
recompiling any altered modules.

Computing a digest of all git-tracked files seems like the simplest way
to key compilation for now.
This commit is contained in:
patrick brisbin 2018-01-22 19:49:02 -05:00
parent b25ddab6f6
commit 30851ae5fb

View File

@ -7,9 +7,13 @@ jobs:
- image: fpco/stack-build:lts
steps:
- checkout
- run:
name: Source digest
command: git ls-files | xargs md5sum > digest
- restore_cache:
keys:
- stack-{{ .Branch }}-{{ checksum "stack.yaml" }}
- stack-{{ .Branch }}-{{ checksum "digest" }}
- stack-{{ .Branch }}
- stack-
- run:
@ -19,7 +23,7 @@ jobs:
name: Build
command: make build
- save_cache:
key: stack-{{ .Branch }}-{{ checksum "stack.yaml" }}
key: stack-{{ .Branch }}-{{ checksum "digest" }}
paths:
- ~/.stack
- ./.stack-work