More details about BUNDLE_GEMFILE

This commit is contained in:
Benoit Daloze
2020-11-27 11:16:50 +01:00
committed by GitHub
parent 4d7e038419
commit 21351ecc0a
+3 -3
View File
@@ -136,14 +136,13 @@ This caching speeds up installing gems significantly and avoids too many request
It needs a `Gemfile` (or `$BUNDLE_GEMFILE` or `gems.rb`) under the [`working-directory`](#working-directory). It needs a `Gemfile` (or `$BUNDLE_GEMFILE` or `gems.rb`) under the [`working-directory`](#working-directory).
If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bundle config --local deployment true` is used. If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bundle config --local deployment true` is used.
To use a `Gemfile` which is not at the root, set `BUNDLE_GEMFILE` in the `env` at the job level, so it is set for all steps: To use a `Gemfile` which is not at the root or has a different name, set `BUNDLE_GEMFILE` in the `env` at the job level, so it is set for all steps:
```yaml ```yaml
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
BUNDLE_GEMFILE: subdir/Gemfile BUNDLE_GEMFILE: subdir/mygemfile
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@v1
@@ -152,6 +151,7 @@ jobs:
bundler-cache: true bundler-cache: true
- run: bundle exec rake - run: bundle exec rake
``` ```
Of course you can also use a matrix of gemfiles if you need to test multiple gemfiles.
To perform caching, this action will use `bundle config --local path vendor/bundle`. To perform caching, this action will use `bundle config --local path vendor/bundle`.
Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`). Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).