mirror of
https://code.forgejo.org/actions/cache.git
synced 2024-11-26 08:41:01 -05:00
Update Ruby - Bundler example
This commit is contained in:
parent
5ca27f25cb
commit
2e80258086
1 changed files with 15 additions and 8 deletions
23
examples.md
23
examples.md
|
@ -430,21 +430,28 @@ Replace `~/.local/share/renv` with the correct `path` if not using Ubuntu.
|
||||||
|
|
||||||
## Ruby - Bundler
|
## Ruby - Bundler
|
||||||
|
|
||||||
|
[`ruby/setup-ruby`](https://github.com/ruby/setup-ruby) provides a way to automatically run `bundle install` and cache the result:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
bundler-cache: true
|
||||||
|
```
|
||||||
|
|
||||||
|
If necessary, you can also cache gems manually using `actions/cache`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: vendor/bundle
|
path: vendor/bundle
|
||||||
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-gems-
|
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
|
||||||
```
|
- name: bundle install
|
||||||
When dependencies are installed later in the workflow, we must specify the same path for the bundler.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- name: Bundle install
|
|
||||||
run: |
|
run: |
|
||||||
|
bundle config deployment true
|
||||||
bundle config path vendor/bundle
|
bundle config path vendor/bundle
|
||||||
bundle install --jobs 4 --retry 3
|
bundle install --jobs 4
|
||||||
```
|
```
|
||||||
|
|
||||||
## Rust - Cargo
|
## Rust - Cargo
|
||||||
|
|
Loading…
Reference in a new issue