Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundler-cache doesn't work with different working-directories. #350

Closed
fsimonis opened this issue Jun 27, 2022 · 3 comments
Closed

bundler-cache doesn't work with different working-directories. #350

fsimonis opened this issue Jun 27, 2022 · 3 comments

Comments

@fsimonis
Copy link

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

@eregon
Copy link
Member

eregon commented Jun 27, 2022

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.

@fsimonis
Copy link
Author

An alternative would be to create and extract the cache relative to the working directory.

This way, both workflows use a single cache.

@eregon
Copy link
Member

eregon commented Jun 28, 2022

I think that wouldn't work, there will be most likely absolute paths e.g. embedded in built C extensions.

@eregon eregon closed this as completed in f60ef1e Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants