I have a rails app that compiles assets as part of the test suite. What was working before is no longer working:
steps:
- checkout
- run: mkdir -p tmp/test/cache/assets
- attach_workspace:
at: ~/fworkspace
- run: tar -cf - app/assets | md5sum > asset_checksum.txt
- restore_cache:
keys:
- v4-app-assets-{{ checksum "asset_checksum.txt" }}
- v4-app-assets-
- run: npm install
- run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- run: bundle exec rake assets:precompile
- save_cache:
key: v4-app-assets-{{ checksum "asset_checksum.txt" }}
paths:
- tmp/test/cache/assets
- public/assets
- persist_to_workspace:
root: ~/fworkspace
paths:
- tmp/test/cache/assets
- public/assets
This used to check if there are any changes in the app/assets folder, and if not restore from cache, but if there are, go ahead and compile assets without restoring from cache.
I also tried a second suggestion found on the discussion boards:
- run: | echo $(find ./app/assets -type f -exec md5sum {} \; | md5sum | cut -d' ' -f1) >> ASSET_CACHE_KEY
This also does not see to generate the same key for the same app/assets. Any suggests what I may be doing wrong here?