Show a full example for caching bundle install

* Which should help avoid conflicts with previous caches
* See https://github.com/eregon/use-ruby-action/issues/7
This commit is contained in:
Benoit Daloze
2020-01-10 23:00:33 +01:00
parent 0b83c28888
commit 51f9fc6d8a
2 changed files with 21 additions and 1 deletions
+20 -1
View File
@@ -92,7 +92,26 @@ Otherwise (Ruby < 2.6), Bundler 1 is installed when that Ruby was built.
### Caching `bundle install`
See this [example](https://github.com/actions/cache/blob/master/examples.md#ruby---gem) using [actions/cache](https://github.com/actions/cache).
You can cache the installed gems with these two steps:
```yaml
- uses: actions/cache@v1
with:
path: vendor/bundle
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
- name: Bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
```
When using a single job, replace `${{ matrix.ruby }}` with the ruby version used or `${{ hashFiles('.ruby-version') }}`.
This uses the [cache action](https://github.com/actions/cache).
The code above is more complete version of the [Gem example](https://github.com/actions/cache/blob/master/examples.md#ruby---gem).
Make sure to include `use-ruby` in the `key` to avoid conflicting with previous caches.
## Limitations
Generated Vendored
+1
View File
@@ -1400,6 +1400,7 @@ async function run() {
rubyPrefix = await windows.downloadExtractAndSetPATH(ruby)
} else {
if (ruby.startsWith('jruby')) {
// Workaround for https://github.com/actions/virtual-environments/issues/242
core.exportVariable('CLASSPATH', '')
}
rubyPrefix = await downloadAndExtract(platform, ruby)