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 | ||
|
|
7da380d64e | ||
|
|
5f2df8a190 |
@@ -16,10 +16,6 @@ jobs:
|
||||
# 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 ]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
ruby: 2.3
|
||||
- os: windows-latest
|
||||
ruby: jruby
|
||||
- os: windows-latest
|
||||
ruby: truffleruby
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -30,9 +26,10 @@ jobs:
|
||||
ruby-version: ${{ matrix.ruby }}
|
||||
- run: ruby --version
|
||||
- run: ridk version
|
||||
if: matrix.os == 'windows-latest'
|
||||
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3')
|
||||
- name: OpenSSL version
|
||||
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION'
|
||||
if: matrix.os == 'windows-latest'
|
||||
- name: OpenSSL test
|
||||
run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }'
|
||||
- name: C extension test
|
||||
|
||||
@@ -15,9 +15,6 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
||||
| JRuby | 9.2.9.0 |
|
||||
| TruffleRuby | 19.3.0, 19.3.1 |
|
||||
|
||||
See [versions.json](https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json)
|
||||
for the always up-to-date list of available Ruby versions.
|
||||
|
||||
Note that Ruby 2.3 and the OpenSSL version it needs (1.0.2) are both end-of-life,
|
||||
which means Ruby 2.3 is unmaintained and considered insecure.
|
||||
On Windows, Ruby 2.4 uses OpenSSL 1.0.2, which is no longer maintained.
|
||||
@@ -32,10 +29,10 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
|
||||
| macOS | `macos-latest` |
|
||||
| Windows | `windows-latest` |
|
||||
|
||||
Ruby 2.3, 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)
|
||||
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)
|
||||
for Ubuntu and macOS and at [ruby-installer-versions.js](https://github.com/eregon/use-ruby-action/blob/master/ruby-installer-versions.js) for Windows.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
+22
-14
@@ -1386,17 +1386,17 @@ const core = __webpack_require__(470)
|
||||
async function run() {
|
||||
try {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||
|
||||
let installer
|
||||
if (platform === 'windows-latest') {
|
||||
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||
installer = __webpack_require__(826)
|
||||
} else {
|
||||
installer = __webpack_require__(442)
|
||||
}
|
||||
|
||||
const input = core.getInput('ruby-version')
|
||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
||||
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)
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
@@ -1425,9 +1425,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
return [engine, version]
|
||||
}
|
||||
|
||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||
if (!engineVersions) {
|
||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
||||
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||
}
|
||||
|
||||
if (!engineVersions.includes(version)) {
|
||||
@@ -1436,9 +1436,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
if (found) {
|
||||
version = found
|
||||
} else {
|
||||
throw new Error(`Unknown version ${version} for ${engine}
|
||||
input: ${input}
|
||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
||||
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||
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__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; });
|
||||
/* 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 io = __webpack_require__(1)
|
||||
const tc = __webpack_require__(533)
|
||||
@@ -4866,12 +4867,12 @@ async function getAvailableVersions(engine) {
|
||||
|
||||
async function install(platform, ruby) {
|
||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||
core.addPath(`${rubyPrefix}/bin`)
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
return rubyPrefix
|
||||
}
|
||||
|
||||
async function downloadAndExtract(platform, ruby) {
|
||||
const rubiesDir = `${process.env.HOME}/.rubies`
|
||||
const rubiesDir = path.join(os.homedir(), '.rubies')
|
||||
await io.mkdirP(rubiesDir)
|
||||
|
||||
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
||||
@@ -4880,7 +4881,7 @@ async function downloadAndExtract(platform, ruby) {
|
||||
const downloadPath = await tc.downloadTool(url)
|
||||
await tc.extractTar(downloadPath, rubiesDir)
|
||||
|
||||
return `${rubiesDir}/${ruby}`
|
||||
return path.join(rubiesDir, ruby)
|
||||
}
|
||||
|
||||
|
||||
@@ -5682,6 +5683,9 @@ function _evaluateVersions(versions, versionSpec) {
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "versions", function() { return versions; });
|
||||
const versions = {
|
||||
"2.3.0": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.0-x64-mingw32.7z",
|
||||
"2.3.1": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.1-x64-mingw32.7z",
|
||||
"2.3.3": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.3-x64-mingw32.7z",
|
||||
"2.4.1": "https://github.com/oneclick/rubyinstaller2/releases/download/2.4.1-2/rubyinstaller-2.4.1-2-x64.7z",
|
||||
"2.4.2": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.2-2/rubyinstaller-2.4.2-2-x64.7z",
|
||||
"2.4.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.3-2/rubyinstaller-2.4.3-2-x64.7z",
|
||||
@@ -7794,10 +7798,14 @@ async function install(platform, ruby) {
|
||||
await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`)
|
||||
const rubyPrefix = `C:\\${base}`
|
||||
|
||||
const msys2 = await linkMSYS2()
|
||||
const [hostedRuby, msys2] = await linkMSYS2()
|
||||
const newPath = setupPath(msys2, rubyPrefix)
|
||||
core.exportVariable('PATH', newPath)
|
||||
|
||||
if (version.startsWith('2.3')) {
|
||||
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
||||
await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`)
|
||||
}
|
||||
@@ -7817,7 +7825,7 @@ async function linkMSYS2() {
|
||||
const hostedMSYS2 = `${latestHostedRuby}\\msys64`
|
||||
const msys2 = 'C:\\msys64'
|
||||
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
|
||||
return msys2
|
||||
return [latestHostedRuby, msys2]
|
||||
}
|
||||
|
||||
function setupPath(msys2, rubyPrefix) {
|
||||
|
||||
@@ -18,7 +18,7 @@ versions = entries.select { |entry|
|
||||
}.sort_by { |version, entry|
|
||||
version
|
||||
}.select { |version, entry|
|
||||
version >= "2.4"
|
||||
version >= "2.3"
|
||||
}.map { |version, entry|
|
||||
[version, entry[:href]]
|
||||
}.to_h
|
||||
|
||||
@@ -5,17 +5,17 @@ const core = require('@actions/core')
|
||||
async function run() {
|
||||
try {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||
|
||||
let installer
|
||||
if (platform === 'windows-latest') {
|
||||
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||
installer = require('./windows')
|
||||
} else {
|
||||
installer = require('./ruby-install-builder')
|
||||
}
|
||||
|
||||
const input = core.getInput('ruby-version')
|
||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
||||
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)
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
@@ -44,9 +44,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
return [engine, version]
|
||||
}
|
||||
|
||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||
if (!engineVersions) {
|
||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
||||
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||
}
|
||||
|
||||
if (!engineVersions.includes(version)) {
|
||||
@@ -55,9 +55,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
if (found) {
|
||||
version = found
|
||||
} else {
|
||||
throw new Error(`Unknown version ${version} for ${engine}
|
||||
input: ${input}
|
||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
||||
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||
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 io = require('@actions/io')
|
||||
const tc = require('@actions/tool-cache')
|
||||
@@ -15,12 +17,12 @@ export async function getAvailableVersions(engine) {
|
||||
|
||||
export async function install(platform, ruby) {
|
||||
const rubyPrefix = await downloadAndExtract(platform, ruby)
|
||||
core.addPath(`${rubyPrefix}/bin`)
|
||||
core.addPath(path.join(rubyPrefix, 'bin'))
|
||||
return rubyPrefix
|
||||
}
|
||||
|
||||
async function downloadAndExtract(platform, ruby) {
|
||||
const rubiesDir = `${process.env.HOME}/.rubies`
|
||||
const rubiesDir = path.join(os.homedir(), '.rubies')
|
||||
await io.mkdirP(rubiesDir)
|
||||
|
||||
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
|
||||
@@ -29,5 +31,5 @@ async function downloadAndExtract(platform, ruby) {
|
||||
const downloadPath = await tc.downloadTool(url)
|
||||
await tc.extractTar(downloadPath, rubiesDir)
|
||||
|
||||
return `${rubiesDir}/${ruby}`
|
||||
return path.join(rubiesDir, ruby)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export const versions = {
|
||||
"2.3.0": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.0-x64-mingw32.7z",
|
||||
"2.3.1": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.1-x64-mingw32.7z",
|
||||
"2.3.3": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.3.3-x64-mingw32.7z",
|
||||
"2.4.1": "https://github.com/oneclick/rubyinstaller2/releases/download/2.4.1-2/rubyinstaller-2.4.1-2-x64.7z",
|
||||
"2.4.2": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.2-2/rubyinstaller-2.4.2-2-x64.7z",
|
||||
"2.4.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.3-2/rubyinstaller-2.4.3-2-x64.7z",
|
||||
|
||||
+6
-2
@@ -29,10 +29,14 @@ export async function install(platform, ruby) {
|
||||
await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`)
|
||||
const rubyPrefix = `C:\\${base}`
|
||||
|
||||
const msys2 = await linkMSYS2()
|
||||
const [hostedRuby, msys2] = await linkMSYS2()
|
||||
const newPath = setupPath(msys2, rubyPrefix)
|
||||
core.exportVariable('PATH', newPath)
|
||||
|
||||
if (version.startsWith('2.3')) {
|
||||
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
|
||||
await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`)
|
||||
}
|
||||
@@ -52,7 +56,7 @@ async function linkMSYS2() {
|
||||
const hostedMSYS2 = `${latestHostedRuby}\\msys64`
|
||||
const msys2 = 'C:\\msys64'
|
||||
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
|
||||
return msys2
|
||||
return [latestHostedRuby, msys2]
|
||||
}
|
||||
|
||||
function setupPath(msys2, rubyPrefix) {
|
||||
|
||||
Reference in New Issue
Block a user