Compare commits

..
5 Commits
4 changed files with 36 additions and 5 deletions
+19
View File
@@ -0,0 +1,19 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!--
Before filing this issue:
* If the issue happens on JRuby or TruffleRuby, and does not happen on CRuby (please check), file an issue there instead. It's very unlikely ruby/setup-ruby is the cause.
* Try to reproduce the issue locally by following the workflow steps (including all all commands done by ruby/setup-ruby, except for `Downloading Ruby` & `Extracting Ruby`). If it does reproduce locally, it's not a ruby/setup-ruby issue.
Please provide:
* the code of or a link to the workflow used
* the link to the log of a failed workflow job
* the command and output of the step failing
-->
+13 -3
View File
@@ -57,7 +57,7 @@ for Ubuntu and macOS and in [windows-versions.js](windows-versions.js) for Windo
```yaml
name: My workflow
on: [push]
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
@@ -76,7 +76,7 @@ This matrix tests all stable releases and `head` versions of MRI, JRuby and Truf
```yaml
name: My workflow
on: [push]
on: [push, pull_request]
jobs:
test:
strategy:
@@ -98,7 +98,7 @@ jobs:
```yaml
name: My workflow
on: [push]
on: [push, pull_request]
jobs:
test:
strategy:
@@ -162,9 +162,19 @@ If there is a `Gemfile.lock` (or `$BUNDLE_GEMFILE.lock` or `gems.locked`), `bund
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
as shown in the [example](#matrix-of-gemfiles).
When there is no lockfile, one is generated with `bundle lock`, which is the same as `bundle install` would do first before actually fetching any gem.
In other words, it works exactly like `bundle install`.
The hash of the generated lockfile is then used for caching, which is the only correct approach.
To perform caching, this action will use `bundle config --local path $PWD/vendor/bundle`.
Therefore, the Bundler `path` should not be changed in your workflow for the cache to work (no `bundle config path`).
#### Caching `bundle install` manually
It is also possible to cache gems manually, but this is not recommended because it is verbose and *very difficult* to do correctly.
There are many concerns which means using `actions/cache` is never enough for caching gems (e.g., incomplete cache key, cleaning old gems when restoring from another key, correctly hashing the lockfile if not checked in, OS versions, ABI compatibility for `ruby-head`, etc).
So, please use `bundler-cache: true` instead and report any issue.
## Windows
Note that running CI on Windows can be quite challenging if you are not very familiar with Windows.
Generated Vendored
+2 -1
View File
@@ -52058,7 +52058,8 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
console.log(`Using Bundler 1 shipped with ${engine}`)
} else {
const gem = path.join(rubyPrefix, 'bin', 'gem')
await exec.exec(gem, ['install', 'bundler', '-v', `~> ${bundlerVersion}`, '--no-document'])
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint, '--no-document'])
}
return bundlerVersion
+2 -1
View File
@@ -229,7 +229,8 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
console.log(`Using Bundler 1 shipped with ${engine}`)
} else {
const gem = path.join(rubyPrefix, 'bin', 'gem')
await exec.exec(gem, ['install', 'bundler', '-v', `~> ${bundlerVersion}`, '--no-document'])
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint, '--no-document'])
}
return bundlerVersion