mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbac26120b | ||
|
|
0f26fedc26 |
@@ -16,8 +16,6 @@ jobs:
|
|||||||
# Use various version syntaxes here for testing
|
# Use various version syntaxes here for testing
|
||||||
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ]
|
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ]
|
||||||
exclude:
|
exclude:
|
||||||
- os: windows-latest
|
|
||||||
ruby: jruby
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
ruby: truffleruby
|
ruby: truffleruby
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
|
|||||||
| macOS | `macos-latest` |
|
| macOS | `macos-latest` |
|
||||||
| Windows | `windows-latest` |
|
| Windows | `windows-latest` |
|
||||||
|
|
||||||
JRuby and TruffleRuby are not yet supported on `windows-latest`.
|
|
||||||
|
|
||||||
The prebuilt rubies are generated by [eregon/ruby-install-builder](https://github.com/eregon/ruby-install-builder)
|
The prebuilt rubies are generated by [eregon/ruby-install-builder](https://github.com/eregon/ruby-install-builder)
|
||||||
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
|
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
|
||||||
The full list of available Ruby versions can be seen at [versions.json](https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json)
|
The full list of available Ruby versions can be seen at [versions.json](https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json)
|
||||||
|
|||||||
+13
-12
@@ -1386,17 +1386,17 @@ const core = __webpack_require__(470)
|
|||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const platform = getVirtualEnvironmentName()
|
const platform = getVirtualEnvironmentName()
|
||||||
|
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||||
|
|
||||||
let installer
|
let installer
|
||||||
if (platform === 'windows-latest') {
|
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||||
installer = __webpack_require__(826)
|
installer = __webpack_require__(826)
|
||||||
} else {
|
} else {
|
||||||
installer = __webpack_require__(442)
|
installer = __webpack_require__(442)
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = core.getInput('ruby-version')
|
|
||||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
|
||||||
const engineVersions = await installer.getAvailableVersions(engine)
|
const engineVersions = await installer.getAvailableVersions(engine)
|
||||||
const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version)
|
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||||
|
|
||||||
const rubyPrefix = await installer.install(platform, ruby)
|
const rubyPrefix = await installer.install(platform, ruby)
|
||||||
core.setOutput('ruby-prefix', rubyPrefix)
|
core.setOutput('ruby-prefix', rubyPrefix)
|
||||||
@@ -1425,9 +1425,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
return [engine, version]
|
return [engine, version]
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||||
if (!engineVersions) {
|
if (!engineVersions) {
|
||||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!engineVersions.includes(version)) {
|
if (!engineVersions.includes(version)) {
|
||||||
@@ -1436,9 +1436,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
|||||||
if (found) {
|
if (found) {
|
||||||
version = found
|
version = found
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown version ${version} for ${engine}
|
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||||
input: ${input}
|
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
|
||||||
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4849,6 +4848,8 @@ function escape(s) {
|
|||||||
__webpack_require__.r(__webpack_exports__);
|
__webpack_require__.r(__webpack_exports__);
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
|
||||||
|
const os = __webpack_require__(87)
|
||||||
|
const path = __webpack_require__(622)
|
||||||
const core = __webpack_require__(470)
|
const core = __webpack_require__(470)
|
||||||
const io = __webpack_require__(1)
|
const io = __webpack_require__(1)
|
||||||
const tc = __webpack_require__(533)
|
const tc = __webpack_require__(533)
|
||||||
@@ -4866,12 +4867,12 @@ async function getAvailableVersions(engine) {
|
|||||||
|
|
||||||
async function install(platform, ruby) {
|
async function install(platform, ruby) {
|
||||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||||
core.addPath(`${rubyPrefix}/bin`)
|
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||||
return rubyPrefix
|
return rubyPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadAndExtract(platform, ruby) {
|
async function downloadAndExtract(platform, ruby) {
|
||||||
const rubiesDir = `${process.env.HOME}/.rubies`
|
const rubiesDir = path.join(os.homedir(), '.rubies')
|
||||||
await io.mkdirP(rubiesDir)
|
await io.mkdirP(rubiesDir)
|
||||||
|
|
||||||
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
||||||
@@ -4880,7 +4881,7 @@ async function downloadAndExtract(platform, ruby) {
|
|||||||
const downloadPath = await tc.downloadTool(url)
|
const downloadPath = await tc.downloadTool(url)
|
||||||
await tc.extractTar(downloadPath, rubiesDir)
|
await tc.extractTar(downloadPath, rubiesDir)
|
||||||
|
|
||||||
return `${rubiesDir}/${ruby}`
|
return path.join(rubiesDir, ruby)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,17 @@ const core = require('@actions/core')
|
|||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const platform = getVirtualEnvironmentName()
|
const platform = getVirtualEnvironmentName()
|
||||||
|
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||||
|
|
||||||
let installer
|
let installer
|
||||||
if (platform === 'windows-latest') {
|
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||||
installer = require('./windows')
|
installer = require('./windows')
|
||||||
} else {
|
} else {
|
||||||
installer = require('./ruby-install-builder')
|
installer = require('./ruby-install-builder')
|
||||||
}
|
}
|
||||||
|
|
||||||
const input = core.getInput('ruby-version')
|
|
||||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
|
||||||
const engineVersions = await installer.getAvailableVersions(engine)
|
const engineVersions = await installer.getAvailableVersions(engine)
|
||||||
const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version)
|
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||||
|
|
||||||
const rubyPrefix = await installer.install(platform, ruby)
|
const rubyPrefix = await installer.install(platform, ruby)
|
||||||
core.setOutput('ruby-prefix', rubyPrefix)
|
core.setOutput('ruby-prefix', rubyPrefix)
|
||||||
@@ -44,9 +44,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
|||||||
return [engine, version]
|
return [engine, version]
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||||
if (!engineVersions) {
|
if (!engineVersions) {
|
||||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!engineVersions.includes(version)) {
|
if (!engineVersions.includes(version)) {
|
||||||
@@ -55,9 +55,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
|||||||
if (found) {
|
if (found) {
|
||||||
version = found
|
version = found
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown version ${version} for ${engine}
|
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||||
input: ${input}
|
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
|
||||||
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const os = require('os')
|
||||||
|
const path = require('path')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const io = require('@actions/io')
|
const io = require('@actions/io')
|
||||||
const tc = require('@actions/tool-cache')
|
const tc = require('@actions/tool-cache')
|
||||||
@@ -15,12 +17,12 @@ export async function getAvailableVersions(engine) {
|
|||||||
|
|
||||||
export async function install(platform, ruby) {
|
export async function install(platform, ruby) {
|
||||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||||
core.addPath(`${rubyPrefix}/bin`)
|
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||||
return rubyPrefix
|
return rubyPrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
async function downloadAndExtract(platform, ruby) {
|
async function downloadAndExtract(platform, ruby) {
|
||||||
const rubiesDir = `${process.env.HOME}/.rubies`
|
const rubiesDir = path.join(os.homedir(), '.rubies')
|
||||||
await io.mkdirP(rubiesDir)
|
await io.mkdirP(rubiesDir)
|
||||||
|
|
||||||
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
||||||
@@ -29,5 +31,5 @@ async function downloadAndExtract(platform, ruby) {
|
|||||||
const downloadPath = await tc.downloadTool(url)
|
const downloadPath = await tc.downloadTool(url)
|
||||||
await tc.extractTar(downloadPath, rubiesDir)
|
await tc.extractTar(downloadPath, rubiesDir)
|
||||||
|
|
||||||
return `${rubiesDir}/${ruby}`
|
return path.join(rubiesDir, ruby)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user