Merge pull request #514 from eregon/recommend-setup-ruby-bundler-cache

Recommend ruby/setup-ruby's bundler-cache: true option
This commit is contained in:
Konrad Pabjan 2021-02-02 21:29:35 +01:00 committed by GitHub
commit 56a8a2f775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -468,21 +468,18 @@ Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
## Ruby - Bundler ## Ruby - Bundler
```yaml Caching gems with Bundler correctly is not trivial and just using `actions/cache`
- uses: actions/cache@v2 is [not enough](https://github.com/ruby/setup-ruby#caching-bundle-install-manually).
with:
path: vendor/bundle Instead, it is recommended to use `ruby/setup-ruby`'s
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} [`bundler-cache: true` option](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically)
restore-keys: | whenever possible:
${{ runner.os }}-gems-
```
When dependencies are installed later in the workflow, we must specify the same path for the bundler.
```yaml ```yaml
- name: Bundle install - uses: ruby/setup-ruby@v1
run: | with:
bundle config path vendor/bundle ruby-version: ...
bundle install --jobs 4 --retry 3 bundler-cache: true
``` ```
## Rust - Cargo ## Rust - Cargo