At the moment, I'm saving cache on the same directory multiple times:
- save_cache: key: dot-stack-{{ checksum "resolver.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw paths: ~/.stack - save_cache: key: dot-stack-{{ checksum "ghc-version.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw paths: ~/.stack - save_cache: key: dot-stack-{{ checksum "resolver.conf" }}-build-gz8vvsw paths: ~/.stack - save_cache: key: dot-stack-{{ checksum "ghc-version.conf" }}-build-gz8vvsw paths: ~/.stack - save_cache: key: dot-stack-work-{{ checksum "resolver.conf" }}-gz8vvsw paths: ~/project/.stack-work
I do this because when I restore the cache, I attempt to restore from the same keys in reverse. This allows me to pick the
best
cache, defined as the cache that is most likely to require the least amount of rebuilding and gracefully fallback to a not as good cache.
Unfortunately, when I do this, Circle CI counts each save as a separate upload.
It ought to be possible to upload the cache once and give it multiple keys:
- save_cache: keys: - dot-stack-{{ checksum "resolver.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw - dot-stack-{{ checksum "ghc-version.conf" }}-{{ checksum "package.yaml" }}-gz8vvsw - dot-stack-{{ checksum "resolver.conf" }}-build-gz8vvsw - dot-stack-{{ checksum "ghc-version.conf" }}-build-gz8vvsw paths: ~/.stack - save_cache: key: dot-stack-work-{{ checksum "resolver.conf" }}-gz8vvsw paths: ~/project/.stack-work
CCI-I-442