From 30851ae5fbe4afd5a44923fc55135c54db732011 Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Mon, 22 Jan 2018 19:49:02 -0500 Subject: [PATCH] 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. --- .circleci/config.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0a498ec..a92a340 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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