Compare commits

...
10 Commits
10 changed files with 149 additions and 127 deletions
+2
View File
@@ -35,6 +35,8 @@ jobs:
- run: ruby --version - run: ruby --version
- run: ridk version - run: ridk version
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3') if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3')
- name: Subprocess test
run: ruby test_subprocess.rb
- name: OpenSSL version - name: OpenSSL version
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION' run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION'
- name: OpenSSL test - name: OpenSSL test
+14 -7
View File
@@ -1,10 +1,15 @@
# use-ruby-action # setup-ruby
Note: this action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.
This action downloads a prebuilt ruby and adds it to the `PATH`. This action downloads a prebuilt ruby and adds it to the `PATH`.
It is very efficient and takes about 5 seconds to download, extract and add the given Ruby to the `PATH`. It is very efficient and takes about 5 seconds to download, extract and add the given Ruby to the `PATH`.
No extra packages need to be installed. No extra packages need to be installed.
Compared to [actions/setup-ruby](https://github.com/actions/setup-ruby),
this actions supports many more versions and features.
### Supported Versions ### Supported Versions
This action currently supports these versions of MRI, JRuby and TruffleRuby: This action currently supports these versions of MRI, JRuby and TruffleRuby:
@@ -14,7 +19,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
| Ruby | 2.3.0 - 2.3.8, 2.4.0 - 2.4.9, 2.5.0 - 2.5.7, 2.6.0 - 2.6.5, 2.7.0, head | | Ruby | 2.3.0 - 2.3.8, 2.4.0 - 2.4.9, 2.5.0 - 2.5.7, 2.6.0 - 2.6.5, 2.7.0, head |
| JRuby | 9.2.9.0 | | JRuby | 9.2.9.0 |
| TruffleRuby | 19.3.0, 19.3.1, head | | TruffleRuby | 19.3.0, 19.3.1, head |
| Rubinius | 4.13 | | Rubinius | 4.14 |
Note that Ruby 2.3 and the OpenSSL version it needs (1.0.2) are both end-of-life, 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. which means Ruby 2.3 is unmaintained and considered insecure.
@@ -32,9 +37,10 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
Rubinius is only available on `ubuntu-latest`. Rubinius is only available on `ubuntu-latest`.
The prebuilt rubies are generated by [eregon/ruby-install-builder](https://github.com/eregon/ruby-install-builder) The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-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 in [ruby-install-builder-versions.js](ruby-install-builder-versions.js) `ruby-head` is generated by [ruby-dev-builder](https://github.com/ruby/ruby-dev-builder) and `truffleruby-head` is generated by [truffleruby-dev-builder](https://github.com/ruby/truffleruby-dev-builder).
The full list of available Ruby versions can be seen in [ruby-builder-versions.js](ruby-builder-versions.js)
for Ubuntu and macOS and in [windows-versions.js](windows-versions.js) for Windows. for Ubuntu and macOS and in [windows-versions.js](windows-versions.js) for Windows.
## Usage ## Usage
@@ -49,7 +55,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: eregon/use-ruby-action@v1 - uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.6 ruby-version: 2.6
- run: ruby -v - run: ruby -v
@@ -72,7 +78,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: eregon/use-ruby-action@v1 - uses: ruby/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
- run: ruby -v - run: ruby -v
@@ -127,5 +133,6 @@ This follows the [recommendations](https://github.com/actions/toolkit/blob/maste
## Credits ## Credits
The current maintainer of this action is @eregon.
Most of the Windows logic is from https://github.com/MSP-Greg/actions-ruby by MSP-Greg. Most of the Windows logic is from https://github.com/MSP-Greg/actions-ruby by MSP-Greg.
Many thanks to MSP-Greg and Lars Kanis for the help with Ruby Installer. Many thanks to MSP-Greg and Lars Kanis for the help with Ruby Installer.
Generated Vendored
+108 -108
View File
@@ -1402,7 +1402,7 @@ async function run() {
if (platform === 'windows-latest' && engine !== 'jruby') { if (platform === 'windows-latest' && engine !== 'jruby') {
installer = __webpack_require__(826) installer = __webpack_require__(826)
} else { } else {
installer = __webpack_require__(442) installer = __webpack_require__(489)
} }
const engineVersions = installer.getAvailableVersions(platform, engine) const engineVersions = installer.getAvailableVersions(platform, engine)
@@ -1448,7 +1448,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
} else { } else {
throw new Error(`Unknown version ${version} for ${engine} on ${platform} throw new Error(`Unknown version ${version} for ${engine} on ${platform}
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')} 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`) File an issue at https://github.com/ruby/setup-ruby/issues if would like support for a new version`)
} }
} }
@@ -2134,6 +2134,43 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
exports.debug = debug; // for test exports.debug = debug; // for test
/***/ }),
/***/ 156:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVersions", function() { return getVersions; });
function getVersions(platform) {
const versions = {
"ruby": [
"2.3.0", "2.3.1", "2.3.2", "2.3.3", "2.3.4", "2.3.5", "2.3.6", "2.3.7", "2.3.8",
"2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6", "2.4.7", "2.4.9",
"2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5", "2.5.6", "2.5.7",
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5",
"2.7.0",
"head"
],
"jruby": [
"9.2.9.0"
],
"truffleruby": [
"19.3.0", "19.3.1",
"head"
]
}
if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [
"4.14"
]
}
return versions
}
/***/ }), /***/ }),
/***/ 211: /***/ 211:
@@ -4855,111 +4892,6 @@ function escape(s) {
} }
//# sourceMappingURL=command.js.map //# sourceMappingURL=command.js.map
/***/ }),
/***/ 442:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
"use strict";
__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)
const rubyBuilderVersions = __webpack_require__(451)
const axios = __webpack_require__(53)
const builderReleaseTag = 'builds-newer-openssl'
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases'
function getAvailableVersions(platform, engine) {
return rubyBuilderVersions.getVersions(platform)[engine]
}
async function install(platform, ruby) {
const rubyPrefix = await downloadAndExtract(platform, ruby)
core.addPath(path.join(rubyPrefix, 'bin'))
if (ruby.startsWith('rubinius')) {
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
}
return rubyPrefix
}
async function downloadAndExtract(platform, ruby) {
const rubiesDir = path.join(os.homedir(), '.rubies')
await io.mkdirP(rubiesDir)
const url = await getDownloadURL(platform, ruby)
console.log(url)
const downloadPath = await tc.downloadTool(url)
await tc.extractTar(downloadPath, rubiesDir)
return path.join(rubiesDir, ruby)
}
async function getDownloadURL(platform, ruby) {
if (ruby.endsWith('-head')) {
return getLatestHeadBuildURL(platform, ruby)
} else {
return `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
}
}
async function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0]
const repository = `eregon/${engine}-dev-builder`
const metadataURL = `https://raw.githubusercontent.com/${repository}/metadata/latest_build.tag`
const releasesURL = `https://github.com/${repository}/releases/download`
const response = await axios.get(metadataURL)
const tag = response.data.trim()
return `${releasesURL}/${tag}/${ruby}-${platform}.tar.gz`
}
/***/ }),
/***/ 451:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVersions", function() { return getVersions; });
function getVersions(platform) {
const versions = {
"ruby": [
"2.3.0", "2.3.1", "2.3.2", "2.3.3", "2.3.4", "2.3.5", "2.3.6", "2.3.7", "2.3.8",
"2.4.0", "2.4.1", "2.4.2", "2.4.3", "2.4.4", "2.4.5", "2.4.6", "2.4.7", "2.4.9",
"2.5.0", "2.5.1", "2.5.2", "2.5.3", "2.5.4", "2.5.5", "2.5.6", "2.5.7",
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5",
"2.7.0",
"head"
],
"jruby": [
"9.2.9.0"
],
"truffleruby": [
"19.3.0", "19.3.1",
"head"
]
}
if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [
"4.13"
]
}
return versions
}
/***/ }), /***/ }),
/***/ 470: /***/ 470:
@@ -5199,6 +5131,74 @@ const versions = {
} }
/***/ }),
/***/ 489:
/***/ (function(__unusedmodule, __webpack_exports__, __webpack_require__) {
"use strict";
__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)
const rubyBuilderVersions = __webpack_require__(156)
const axios = __webpack_require__(53)
const builderReleaseTag = 'builds-no-warn'
const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
function getAvailableVersions(platform, engine) {
return rubyBuilderVersions.getVersions(platform)[engine]
}
async function install(platform, ruby) {
const rubyPrefix = await downloadAndExtract(platform, ruby)
core.addPath(path.join(rubyPrefix, 'bin'))
if (ruby.startsWith('rubinius')) {
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
}
return rubyPrefix
}
async function downloadAndExtract(platform, ruby) {
const rubiesDir = path.join(os.homedir(), '.rubies')
await io.mkdirP(rubiesDir)
const url = await getDownloadURL(platform, ruby)
console.log(url)
const downloadPath = await tc.downloadTool(url)
await tc.extractTar(downloadPath, rubiesDir)
return path.join(rubiesDir, ruby)
}
async function getDownloadURL(platform, ruby) {
if (ruby.endsWith('-head')) {
return getLatestHeadBuildURL(platform, ruby)
} else {
return `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
}
}
async function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0]
const repository = `ruby/${engine}-dev-builder`
const metadataURL = `https://raw.githubusercontent.com/${repository}/metadata/latest_build.tag`
const releasesURL = `https://github.com/${repository}/releases/download`
const response = await axios.get(metadataURL)
const tag = response.data.trim()
return `${releasesURL}/${tag}/${ruby}-${platform}.tar.gz`
}
/***/ }), /***/ }),
/***/ 494: /***/ 494:
@@ -7885,7 +7885,7 @@ async function install(platform, ruby) {
} }
const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length) const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length)
// Extract to SSD, see https://github.com/eregon/use-ruby-action/pull/14 // Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0] const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]
const downloadPath = await tc.downloadTool(url) const downloadPath = await tc.downloadTool(url)
+2 -2
View File
@@ -11,7 +11,7 @@ async function run() {
if (platform === 'windows-latest' && engine !== 'jruby') { if (platform === 'windows-latest' && engine !== 'jruby') {
installer = require('./windows') installer = require('./windows')
} else { } else {
installer = require('./ruby-install-builder') installer = require('./ruby-builder')
} }
const engineVersions = installer.getAvailableVersions(platform, engine) const engineVersions = installer.getAvailableVersions(platform, engine)
@@ -57,7 +57,7 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
} else { } else {
throw new Error(`Unknown version ${version} for ${engine} on ${platform} throw new Error(`Unknown version ${version} for ${engine} on ${platform}
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')} 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`) File an issue at https://github.com/ruby/setup-ruby/issues if would like support for a new version`)
} }
} }
+4 -4
View File
@@ -1,5 +1,5 @@
{ {
"name": "use-ruby-action", "name": "setup-ruby",
"version": "0.1.0", "version": "0.1.0",
"description": "Download a prebuilt Ruby and add it to the PATH in 5 seconds", "description": "Download a prebuilt Ruby and add it to the PATH in 5 seconds",
"main": "index.js", "main": "index.js",
@@ -9,7 +9,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/eregon/use-ruby-action.git" "url": "git+https://github.com/ruby/setup-ruby.git"
}, },
"keywords": [ "keywords": [
"GitHub", "GitHub",
@@ -19,9 +19,9 @@
"author": "Benoit Daloze", "author": "Benoit Daloze",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/eregon/use-ruby-action/issues" "url": "https://github.com/ruby/setup-ruby/issues"
}, },
"homepage": "https://github.com/eregon/use-ruby-action", "homepage": "https://github.com/ruby/setup-ruby",
"dependencies": { "dependencies": {
"@actions/core": "^1.1.1", "@actions/core": "^1.1.1",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
@@ -19,7 +19,7 @@ export function getVersions(platform) {
if (platform === 'ubuntu-18.04') { if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [ versions['rubinius'] = [
"4.13" "4.14"
] ]
} }
+4 -4
View File
@@ -3,11 +3,11 @@ 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')
const rubyBuilderVersions = require('./ruby-install-builder-versions') const rubyBuilderVersions = require('./ruby-builder-versions')
const axios = require('axios') const axios = require('axios')
const builderReleaseTag = 'builds-newer-openssl' const builderReleaseTag = 'builds-no-warn'
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases' const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
export function getAvailableVersions(platform, engine) { export function getAvailableVersions(platform, engine) {
return rubyBuilderVersions.getVersions(platform)[engine] return rubyBuilderVersions.getVersions(platform)[engine]
@@ -47,7 +47,7 @@ async function getDownloadURL(platform, ruby) {
async function getLatestHeadBuildURL(platform, ruby) { async function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0] const engine = ruby.split('-')[0]
const repository = `eregon/${engine}-dev-builder` const repository = `ruby/${engine}-dev-builder`
const metadataURL = `https://raw.githubusercontent.com/${repository}/metadata/latest_build.tag` const metadataURL = `https://raw.githubusercontent.com/${repository}/metadata/latest_build.tag`
const releasesURL = `https://github.com/${repository}/releases/download` const releasesURL = `https://github.com/${repository}/releases/download`
+13
View File
@@ -0,0 +1,13 @@
require 'rbconfig'
require 'stringio'
puts "CPPFLAGS: #{RbConfig::CONFIG["CPPFLAGS"]}"
$stderr = StringIO.new
begin
system RbConfig.ruby, "-e", "p :OK"
out = $stderr.string
ensure
$stderr = STDERR
end
abort out unless out.empty?
+1 -1
View File
@@ -25,7 +25,7 @@ export async function install(platform, ruby) {
} }
const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length) const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length)
// Extract to SSD, see https://github.com/eregon/use-ruby-action/pull/14 // Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0] const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]
const downloadPath = await tc.downloadTool(url) const downloadPath = await tc.downloadTool(url)