Created
January 13, 2018 21:02
-
-
Save pftg/92cb374182ffec19c37352c435fb3684 to your computer and use it in GitHub Desktop.
Pre-compile Assets and Cache for CircleCI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- restore_cache: | |
keys: | |
- v1-asset-cache-{{ arch }}-{{ .Branch }} | |
- v1-asset-cache- | |
- run: bundle exec rake assets:precompile | |
- save_cache: | |
key: v1-asset-cache-{{ arch }}-{{ .Branch }}-{{ epoch }} | |
paths: | |
- public/assets | |
- tmp/cache/assets/sprockets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good to know, thanks. My example above with branch-revision should do mostly the same. At least I observe that on re-run it catch the latest branch cache.
update: I ended up hashing all files which may cause assets change and do exact match. Better not to reuse partial cache to avoid bloat and unexpected issues for little if any perf gain. Hashing with the following command
git ls-tree HEAD $(<.circleci/asset_paths) > tmp/assets_related_checksums
, then using keyv1-asset-cache-{{ checksum "tmp/assets_related_checksums" }}
.For full PR you can see 3scale/porta#2630