mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f20f1eae72 | ||
|
|
330f7f5faa | ||
|
|
a2b2637a7c | ||
|
|
e5b2d1fb1e | ||
|
|
b00551441a | ||
|
|
f514fbcdac | ||
|
|
a6f2286594 | ||
|
|
c84889b9b9 | ||
|
|
ac03cb7d18 |
@@ -16,7 +16,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ]
|
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ]
|
||||||
ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
|
ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
|
||||||
include:
|
include:
|
||||||
- { os: windows-2016, ruby: mingw }
|
- { os: windows-2016, ruby: mingw }
|
||||||
- { os: windows-2019, ruby: mingw }
|
- { os: windows-2019, ruby: mingw }
|
||||||
|
|||||||
@@ -19,3 +19,7 @@ It is recommended to add this as a `git` `pre-commit` hook:
|
|||||||
```bash
|
```bash
|
||||||
$ cp pre-commit .git/hooks/pre-commit
|
$ cp pre-commit .git/hooks/pre-commit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Adding a new Ruby version
|
||||||
|
|
||||||
|
Add the new version in `ruby-builder-versions.js` and update the README.
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
|||||||
|
|
||||||
| Interpreter | Versions |
|
| Interpreter | Versions |
|
||||||
| ----------- | -------- |
|
| ----------- | -------- |
|
||||||
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.0.2, head, debug, mingw, mswin |
|
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.1.0-preview1, head, debug, mingw, mswin |
|
||||||
| `jruby` | 9.1.17.0 - 9.3.0.0, head |
|
| `jruby` | 9.1.17.0 - 9.3.1.0, head |
|
||||||
| `truffleruby` | 19.3.0 - 21.2.0.1, head |
|
| `truffleruby` | 19.3.0 - 21.3.0, head |
|
||||||
| `truffleruby+graalvm` | 21.2.0, head |
|
| `truffleruby+graalvm` | 21.2.0 - 21.3.0, head |
|
||||||
|
|
||||||
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
`ruby-debug` is the same as `ruby-head` but with assertions enabled (`-DRUBY_DEBUG=1`).
|
||||||
On Windows, `mingw` and `mswin` are `ruby-head` builds using the MSYS2/MinGW and the MSVC toolchains respectively.
|
On Windows, `mingw` and `mswin` are `ruby-head` builds using the MSYS2/MinGW and the MSVC toolchains respectively.
|
||||||
|
|||||||
+16
-12
@@ -74,7 +74,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
|||||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||||
bundlerVersion = '1'
|
bundlerVersion = '1'
|
||||||
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) {
|
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||||
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
||||||
bundlerVersion = '1'
|
bundlerVersion = '1'
|
||||||
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
||||||
@@ -90,7 +90,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
|||||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||||
} else {
|
} else {
|
||||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||||
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
|
const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,17 +183,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
|||||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
||||||
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||||
|
|
||||||
if (engine !== 'jruby' && common.isHeadVersion(version)) {
|
if (common.isHeadVersion(version)) {
|
||||||
let revision = '';
|
if (engine !== 'jruby') {
|
||||||
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], {
|
// CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
|
||||||
silent: true,
|
let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
|
||||||
listeners: {
|
let abi = ''
|
||||||
stdout: (data) => {
|
await exec.exec('ruby', ['-e', print_abi], {
|
||||||
revision += data.toString();
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
abi += data.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
key += `-ABI-${abi}`
|
||||||
key += `-revision-${revision}`
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
key += `-${lockFile}`
|
key += `-${lockFile}`
|
||||||
|
|||||||
+24
-19
@@ -88,7 +88,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
|||||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||||
bundlerVersion = '1'
|
bundlerVersion = '1'
|
||||||
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) {
|
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||||
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
||||||
bundlerVersion = '1'
|
bundlerVersion = '1'
|
||||||
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
||||||
@@ -104,7 +104,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
|||||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||||
} else {
|
} else {
|
||||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||||
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
|
const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,17 +197,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
|
|||||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
||||||
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||||
|
|
||||||
if (engine !== 'jruby' && common.isHeadVersion(version)) {
|
if (common.isHeadVersion(version)) {
|
||||||
let revision = '';
|
if (engine !== 'jruby') {
|
||||||
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], {
|
// CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
|
||||||
silent: true,
|
let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
|
||||||
listeners: {
|
let abi = ''
|
||||||
stdout: (data) => {
|
await exec.exec('ruby', ['-e', print_abi], {
|
||||||
revision += data.toString();
|
silent: true,
|
||||||
|
listeners: {
|
||||||
|
stdout: (data) => {
|
||||||
|
abi += data.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
key += `-ABI-${abi}`
|
||||||
key += `-revision-${revision}`
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
key += `-${lockFile}`
|
key += `-${lockFile}`
|
||||||
@@ -58773,22 +58777,23 @@ function getVersions(platform) {
|
|||||||
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8",
|
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8",
|
||||||
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4",
|
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4",
|
||||||
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2",
|
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2",
|
||||||
|
"3.1.0-preview1",
|
||||||
"head", "debug"
|
"head", "debug"
|
||||||
],
|
],
|
||||||
"jruby": [
|
"jruby": [
|
||||||
"9.1.17.0",
|
"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.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.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", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.20.0",
|
||||||
"9.3.0.0",
|
"9.3.0.0", "9.3.1.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby": [
|
"truffleruby": [
|
||||||
"19.3.0", "19.3.1",
|
"19.3.0", "19.3.1",
|
||||||
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
||||||
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1",
|
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.3.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby+graalvm": [
|
"truffleruby+graalvm": [
|
||||||
"21.2.0",
|
"21.2.0", "21.3.0",
|
||||||
"head"
|
"head"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -59127,7 +59132,7 @@ function addVCVARSEnv() {
|
|||||||
let newEnv = new Map()
|
let newEnv = new Map()
|
||||||
let cmd = `cmd.exe /c "${vcVars} && set"`
|
let cmd = `cmd.exe /c "${vcVars} && set"`
|
||||||
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
|
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
|
||||||
newSet = newSet.filter(line => line.match(/\S=\S/))
|
newSet = newSet.filter(line => /\S=\S/.test(line))
|
||||||
newSet.forEach(s => {
|
newSet.forEach(s => {
|
||||||
let [k,v] = common.partition(s, '=')
|
let [k,v] = common.partition(s, '=')
|
||||||
newEnv.set(k,v)
|
newEnv.set(k,v)
|
||||||
@@ -59500,13 +59505,13 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
||||||
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
||||||
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => e.match(/^ruby\s/))[0]
|
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
|
||||||
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
|
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
|
||||||
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let engine, version
|
let engine, version
|
||||||
if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
|
if (/^(\d+)/.test(rubyVersion) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
|
||||||
engine = 'ruby'
|
engine = 'ruby'
|
||||||
version = rubyVersion
|
version = rubyVersion
|
||||||
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
|
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
|
||||||
|
|||||||
@@ -91,13 +91,13 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
|
||||||
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
|
||||||
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
|
||||||
const rubyLine = toolVersions.split(/\r?\n/).filter(e => e.match(/^ruby\s/))[0]
|
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
|
||||||
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
|
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
|
||||||
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
|
||||||
}
|
}
|
||||||
|
|
||||||
let engine, version
|
let engine, version
|
||||||
if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
|
if (/^(\d+)/.test(rubyVersion) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
|
||||||
engine = 'ruby'
|
engine = 'ruby'
|
||||||
version = rubyVersion
|
version = rubyVersion
|
||||||
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
|
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
|
||||||
|
|||||||
@@ -11,22 +11,23 @@ export function getVersions(platform) {
|
|||||||
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8",
|
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8",
|
||||||
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4",
|
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4",
|
||||||
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2",
|
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2",
|
||||||
|
"3.1.0-preview1",
|
||||||
"head", "debug"
|
"head", "debug"
|
||||||
],
|
],
|
||||||
"jruby": [
|
"jruby": [
|
||||||
"9.1.17.0",
|
"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.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.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", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.20.0",
|
||||||
"9.3.0.0",
|
"9.3.0.0", "9.3.1.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby": [
|
"truffleruby": [
|
||||||
"19.3.0", "19.3.1",
|
"19.3.0", "19.3.1",
|
||||||
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
||||||
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1",
|
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.3.0",
|
||||||
"head"
|
"head"
|
||||||
],
|
],
|
||||||
"truffleruby+graalvm": [
|
"truffleruby+graalvm": [
|
||||||
"21.2.0",
|
"21.2.0", "21.3.0",
|
||||||
"head"
|
"head"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -134,7 +134,7 @@ export function addVCVARSEnv() {
|
|||||||
let newEnv = new Map()
|
let newEnv = new Map()
|
||||||
let cmd = `cmd.exe /c "${vcVars} && set"`
|
let cmd = `cmd.exe /c "${vcVars} && set"`
|
||||||
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
|
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
|
||||||
newSet = newSet.filter(line => line.match(/\S=\S/))
|
newSet = newSet.filter(line => /\S=\S/.test(line))
|
||||||
newSet.forEach(s => {
|
newSet.forEach(s => {
|
||||||
let [k,v] = common.partition(s, '=')
|
let [k,v] = common.partition(s, '=')
|
||||||
newEnv.set(k,v)
|
newEnv.set(k,v)
|
||||||
|
|||||||
Reference in New Issue
Block a user