mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c10c0bae0 | ||
|
|
312f3d08ba | ||
|
|
273e7443b6 | ||
|
|
33cc6f7238 | ||
|
|
7ac926d65e | ||
|
|
1682e5e389 | ||
|
|
25388a3d11 | ||
|
|
aa7df8d81f | ||
|
|
162161eab5 | ||
|
|
c233f78bee |
@@ -15,8 +15,8 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
||||
| Interpreter | Versions |
|
||||
| ----------- | -------- |
|
||||
| Ruby | 2.1.9, 2.2, 2.3.0 - 2.3.8, 2.4.0 - 2.4.10, 2.5.0 - 2.5.8, 2.6.0 - 2.6.6, 2.7.1, head, debug, mingw, mswin |
|
||||
| JRuby | 9.1.17.0, 9.2.9.0 - 9.2.12.0, head |
|
||||
| TruffleRuby | 19.3.0 - 20.1.0, head |
|
||||
| JRuby | 9.1.17.0, 9.2.9.0 - 9.2.13.0, head |
|
||||
| TruffleRuby | 19.3.0 - 20.2.0, head |
|
||||
| Rubinius | 4.14 |
|
||||
|
||||
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
||||
@@ -108,11 +108,16 @@ and the [condition and expression syntax](https://help.github.com/en/actions/ref
|
||||
* `.tool-versions` reads from the project's `.tool-versions` file
|
||||
* If the `ruby-version` input is not specified, `.ruby-version` is tried first, followed by `.tool-versions`
|
||||
|
||||
### Working Directory
|
||||
|
||||
The `working-directory` input can be set to resolve `.ruby-version`, `.tool-versions` and `Gemfile.lock`
|
||||
if they are not at the root of the repository, see [action.yml](action.yml) for details.
|
||||
|
||||
### Bundler
|
||||
|
||||
By default, if there is a `Gemfile.lock` file with a `BUNDLED WITH` section,
|
||||
By default, if there is a `Gemfile.lock` file (or `$BUNDLE_GEMFILE.lock` if `$BUNDLE_GEMFILE` is set) with a `BUNDLED WITH` section,
|
||||
the latest version of Bundler with the same major version will be installed.
|
||||
Otherwise, the latest Bundler version is installed (except for Ruby 2.2 and 2.3 where only Bundler 1 is supported).
|
||||
Otherwise, the latest compatible Bundler version is installed (Bundler 2 on Ruby >= 2.4, Bundler 1 on Ruby < 2.4).
|
||||
|
||||
This behavior can be customized, see [action.yml](action.yml) for details about the `bundler` input.
|
||||
|
||||
@@ -126,7 +131,7 @@ This action provides a way to automatically run `bundle install` and cache the r
|
||||
```
|
||||
|
||||
This caching speeds up installing gems significantly and avoids too many requests to RubyGems.org.
|
||||
It needs a `Gemfile` under the [`working-directory`](#working-directory).
|
||||
It needs a `Gemfile` (or `$BUNDLE_GEMFILE`) under the [`working-directory`](#working-directory).
|
||||
The caching works whether there is a `Gemfile.lock` or not.
|
||||
If there is a `Gemfile.lock`, `bundle config --local deployment true` is used.
|
||||
|
||||
@@ -159,15 +164,9 @@ When using `.ruby-version`, replace `${{ matrix.ruby }}` with `${{ hashFiles('.r
|
||||
When using `.tool-versions`, replace `${{ matrix.ruby }}` with `${{ hashFiles('.tool-versions') }}`.
|
||||
|
||||
This uses the [cache action](https://github.com/actions/cache).
|
||||
The code above is a more complete version of the [Ruby - Bundler example](https://github.com/actions/cache/blob/master/examples.md#ruby---\
|
||||
bundler).
|
||||
The code above is a more complete version of the [Ruby - Bundler example](https://github.com/actions/cache/blob/master/examples.md#ruby---bundler).
|
||||
Make sure to include `use-ruby` in the `key` to avoid conflicting with previous caches.
|
||||
|
||||
### Working Directory
|
||||
|
||||
The `working-directory` input can be set to resolve `.ruby-version`, `.tool-versions` and `Gemfile.lock`
|
||||
if they are not at the root of the repository, see [action.yml](action.yml) for details.
|
||||
|
||||
## Windows
|
||||
|
||||
Note that running CI on Windows can be quite challenging if you are not very familiar with Windows.
|
||||
@@ -192,9 +191,7 @@ Make sure to always use the latest release before reporting an issue on GitHub.
|
||||
This action follows semantic versioning with a moving `v1` branch.
|
||||
This follows the [recommendations](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) of GitHub Actions.
|
||||
|
||||
## Limitations
|
||||
|
||||
### Using self-hosted runners
|
||||
## Using self-hosted runners
|
||||
You must meet the following parameters to use this action with self-hosted runners:
|
||||
|
||||
* Make sure that the operating system has `libyaml-0` installed
|
||||
|
||||
+4
-1
@@ -10,7 +10,10 @@ inputs:
|
||||
required: false
|
||||
default: 'default'
|
||||
bundler:
|
||||
description: 'The version of Bundler to install. Either none, 1, 2, latest or Gemfile.lock. The default tries Gemfile.lock and otherwise uses latest.'
|
||||
description: |
|
||||
The version of Bundler to install. Either 'none', 1, 2, 'latest' or 'Gemfile.lock'.
|
||||
For 'Gemfile.lock', the version is determined based on the BUNDLED WITH section from the file ($BUNDLE_GEMFILE || Gemfile).lock.
|
||||
Defaults to 'Gemfile.lock' if it exists and 'latest' otherwise.
|
||||
required: false
|
||||
default: 'default'
|
||||
bundler-cache:
|
||||
|
||||
+8
-7
@@ -2339,9 +2339,9 @@ function setupPath(newPathEntries) {
|
||||
core.exportVariable('PATH', [...newPathEntries, ...cleanPath].join(path.delimiter))
|
||||
}
|
||||
|
||||
function readBundledWithFromGemfileLock() {
|
||||
if (fs.existsSync('Gemfile.lock')) {
|
||||
const contents = fs.readFileSync('Gemfile.lock', 'utf8')
|
||||
function readBundledWithFromGemfileLock(path) {
|
||||
if (fs.existsSync(path)) {
|
||||
const contents = fs.readFileSync(path, 'utf8')
|
||||
const lines = contents.split(/\r?\n/)
|
||||
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
||||
if (bundledWithLine !== -1) {
|
||||
@@ -2349,7 +2349,7 @@ function readBundledWithFromGemfileLock() {
|
||||
if (nextLine && /^\d+/.test(nextLine.trim())) {
|
||||
const bundlerVersion = nextLine.trim()
|
||||
const majorVersion = bundlerVersion.match(/^\d+/)[0]
|
||||
console.log(`Using Bundler ${majorVersion} from Gemfile.lock BUNDLED WITH ${bundlerVersion}`)
|
||||
console.log(`Using Bundler ${majorVersion} from ${path} BUNDLED WITH ${bundlerVersion}`)
|
||||
return majorVersion
|
||||
}
|
||||
}
|
||||
@@ -2361,7 +2361,8 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine,
|
||||
var bundlerVersion = bundlerVersionInput
|
||||
|
||||
if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
|
||||
bundlerVersion = readBundledWithFromGemfileLock()
|
||||
const gemfilePath = `${process.env['BUNDLE_GEMFILE'] || 'Gemfile'}.lock`
|
||||
bundlerVersion = readBundledWithFromGemfileLock(gemfilePath)
|
||||
if (!bundlerVersion) {
|
||||
bundlerVersion = 'latest'
|
||||
}
|
||||
@@ -3104,12 +3105,12 @@ function getVersions(platform) {
|
||||
],
|
||||
"jruby": [
|
||||
"9.1.17.0",
|
||||
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0",
|
||||
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0",
|
||||
"head"
|
||||
],
|
||||
"truffleruby": [
|
||||
"19.3.0", "19.3.1",
|
||||
"20.0.0", "20.1.0",
|
||||
"20.0.0", "20.1.0", "20.2.0",
|
||||
"head"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -153,9 +153,9 @@ function setupPath(newPathEntries) {
|
||||
core.exportVariable('PATH', [...newPathEntries, ...cleanPath].join(path.delimiter))
|
||||
}
|
||||
|
||||
function readBundledWithFromGemfileLock() {
|
||||
if (fs.existsSync('Gemfile.lock')) {
|
||||
const contents = fs.readFileSync('Gemfile.lock', 'utf8')
|
||||
function readBundledWithFromGemfileLock(path) {
|
||||
if (fs.existsSync(path)) {
|
||||
const contents = fs.readFileSync(path, 'utf8')
|
||||
const lines = contents.split(/\r?\n/)
|
||||
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
||||
if (bundledWithLine !== -1) {
|
||||
@@ -163,7 +163,7 @@ function readBundledWithFromGemfileLock() {
|
||||
if (nextLine && /^\d+/.test(nextLine.trim())) {
|
||||
const bundlerVersion = nextLine.trim()
|
||||
const majorVersion = bundlerVersion.match(/^\d+/)[0]
|
||||
console.log(`Using Bundler ${majorVersion} from Gemfile.lock BUNDLED WITH ${bundlerVersion}`)
|
||||
console.log(`Using Bundler ${majorVersion} from ${path} BUNDLED WITH ${bundlerVersion}`)
|
||||
return majorVersion
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,8 @@ async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine,
|
||||
var bundlerVersion = bundlerVersionInput
|
||||
|
||||
if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
|
||||
bundlerVersion = readBundledWithFromGemfileLock()
|
||||
const gemfilePath = `${process.env['BUNDLE_GEMFILE'] || 'Gemfile'}.lock`
|
||||
bundlerVersion = readBundledWithFromGemfileLock(gemfilePath)
|
||||
if (!bundlerVersion) {
|
||||
bundlerVersion = 'latest'
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"description": "Download a prebuilt Ruby and add it to the PATH in 5 seconds",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint *.js",
|
||||
"package": "ncc build index.js -o dist"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@@ -12,12 +12,12 @@ export function getVersions(platform) {
|
||||
],
|
||||
"jruby": [
|
||||
"9.1.17.0",
|
||||
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0",
|
||||
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0",
|
||||
"head"
|
||||
],
|
||||
"truffleruby": [
|
||||
"19.3.0", "19.3.1",
|
||||
"20.0.0", "20.1.0",
|
||||
"20.0.0", "20.1.0", "20.2.0",
|
||||
"head"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user