setup-ruby
setup-ruby copied to clipboard
bundler-cache doesn't work with different working-directories.
Using the caching functionality of the action various times using different working-directories leads to incorrectly restored caches.
First workflow runs and caches website/vendor/bundle
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: website
Second workflow runs and restores the cache:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Then the cache gets restored in website/vendor/bundle
instead of vendor/bundle
.
bundle install
runs normally as it is configured to use vendor/bundle
Example of the second workflow. jekyll build
fails here as it picks up files in website/vendor/bundle
Right, so we need to make the value of working-directory:
part of the cache key.
Until then, a workaround is to use cache-version: <working-directory>
to ensure a separate cache per working directory.
An alternative would be to create and extract the cache relative to the working directory.
This way, both workflows use a single cache.
I think that wouldn't work, there will be most likely absolute paths e.g. embedded in built C extensions.