Compare commits

..
4 Commits
Author SHA1 Message Date
Benoit Daloze 6647273ce9 Add support for Ubuntu 20.04 2020-06-07 13:16:44 +02:00
Benoit Daloze 071acb9122 Add script to conveniently print versions for ruby-builder 2020-06-07 13:00:19 +02:00
Benoit Daloze ba5b846810 Add TruffleRuby 20.1.0 2020-06-06 17:04:00 +02:00
Benoit Daloze 81be0938f7 Add an exported setupRuby() function which can be called from other actions
* Inputs are passed as simple object properties.
* It is recommended to expose the same inputs for other actions.
* See #58 and #33.
2020-06-06 13:52:42 +02:00
5 changed files with 60 additions and 20 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
| ----------- | -------- | | ----------- | -------- |
| Ruby | 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 | | Ruby | 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.11.1, head | | JRuby | 9.1.17.0, 9.2.9.0 - 9.2.11.1, head |
| TruffleRuby | 19.3.0 - 20.0.0, head | | TruffleRuby | 19.3.0 - 20.1.0, head |
| Rubinius | 4.14 | | Rubinius | 4.14 |
`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`).
@@ -35,7 +35,7 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
| Operating System | Versions | | Operating System | Versions |
| ----------- | -------- | | ----------- | -------- |
| Ubuntu | `ubuntu-latest` (= `ubuntu-18.04`), `ubuntu-16.04` | | Ubuntu | `ubuntu-20.04`, `ubuntu-latest` (= `ubuntu-18.04`), `ubuntu-16.04` |
| macOS | `macos-latest` | | macOS | `macos-latest` |
| Windows | `windows-latest` | | Windows | `windows-latest` |
Generated Vendored
+22 -9
View File
@@ -969,6 +969,7 @@ module.exports = require("os");
"use strict"; "use strict";
__webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "run", function() { return run; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "run", function() { return run; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupRuby", function() { return setupRuby; });
const os = __webpack_require__(87) const os = __webpack_require__(87)
const fs = __webpack_require__(747) const fs = __webpack_require__(747)
const path = __webpack_require__(622) const path = __webpack_require__(622)
@@ -976,19 +977,31 @@ const core = __webpack_require__(470)
const exec = __webpack_require__(986) const exec = __webpack_require__(986)
const common = __webpack_require__(239) const common = __webpack_require__(239)
const inputDefaults = {
'ruby-version': 'default',
'bundler': 'default',
'working-directory': '.',
}
async function run() { async function run() {
try { try {
await main() const options = {}
for (const key in inputDefaults) {
options[key] = core.getInput(key)
}
await setupRuby(options)
} catch (error) { } catch (error) {
core.setFailed(error.message) core.setFailed(error.message)
} }
} }
async function main() { async function setupRuby(options) {
process.chdir(core.getInput('working-directory')) const inputs = { ...inputDefaults, ...options }
process.chdir(inputs['working-directory'])
const platform = common.getVirtualEnvironmentName() const platform = common.getVirtualEnvironmentName()
const [engine, parsedVersion] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
let installer let installer
if (platform === 'windows-latest' && engine !== 'jruby') { if (platform === 'windows-latest' && engine !== 'jruby') {
@@ -1006,9 +1019,9 @@ async function main() {
setupPath(newPathEntries) setupPath(newPathEntries)
if (core.getInput('bundler') !== 'none') { if (inputs['bundler'] !== 'none') {
await common.measure('Installing Bundler', async () => await common.measure('Installing Bundler', async () =>
installBundler(platform, rubyPrefix, engine, version)) installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
} }
core.setOutput('ruby-prefix', rubyPrefix) core.setOutput('ruby-prefix', rubyPrefix)
@@ -1113,8 +1126,8 @@ function readBundledWithFromGemfileLock() {
return null return null
} }
async function installBundler(platform, rubyPrefix, engine, rubyVersion) { async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine, rubyVersion) {
var bundlerVersion = core.getInput('bundler') var bundlerVersion = bundlerVersionInput
if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') { if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
bundlerVersion = readBundledWithFromGemfileLock() bundlerVersion = readBundledWithFromGemfileLock()
@@ -1476,7 +1489,7 @@ function getVersions(platform) {
], ],
"truffleruby": [ "truffleruby": [
"19.3.0", "19.3.1", "19.3.0", "19.3.1",
"20.0.0", "20.0.0", "20.1.0",
"head" "head"
] ]
} }
+20 -8
View File
@@ -5,19 +5,31 @@ const core = require('@actions/core')
const exec = require('@actions/exec') const exec = require('@actions/exec')
const common = require('./common') const common = require('./common')
const inputDefaults = {
'ruby-version': 'default',
'bundler': 'default',
'working-directory': '.',
}
export async function run() { export async function run() {
try { try {
await main() const options = {}
for (const key in inputDefaults) {
options[key] = core.getInput(key)
}
await setupRuby(options)
} catch (error) { } catch (error) {
core.setFailed(error.message) core.setFailed(error.message)
} }
} }
async function main() { export async function setupRuby(options) {
process.chdir(core.getInput('working-directory')) const inputs = { ...inputDefaults, ...options }
process.chdir(inputs['working-directory'])
const platform = common.getVirtualEnvironmentName() const platform = common.getVirtualEnvironmentName()
const [engine, parsedVersion] = parseRubyEngineAndVersion(core.getInput('ruby-version')) const [engine, parsedVersion] = parseRubyEngineAndVersion(inputs['ruby-version'])
let installer let installer
if (platform === 'windows-latest' && engine !== 'jruby') { if (platform === 'windows-latest' && engine !== 'jruby') {
@@ -35,9 +47,9 @@ async function main() {
setupPath(newPathEntries) setupPath(newPathEntries)
if (core.getInput('bundler') !== 'none') { if (inputs['bundler'] !== 'none') {
await common.measure('Installing Bundler', async () => await common.measure('Installing Bundler', async () =>
installBundler(platform, rubyPrefix, engine, version)) installBundler(inputs['bundler'], platform, rubyPrefix, engine, version))
} }
core.setOutput('ruby-prefix', rubyPrefix) core.setOutput('ruby-prefix', rubyPrefix)
@@ -142,8 +154,8 @@ function readBundledWithFromGemfileLock() {
return null return null
} }
async function installBundler(platform, rubyPrefix, engine, rubyVersion) { async function installBundler(bundlerVersionInput, platform, rubyPrefix, engine, rubyVersion) {
var bundlerVersion = core.getInput('bundler') var bundlerVersion = bundlerVersionInput
if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') { if (bundlerVersion === 'default' || bundlerVersion === 'Gemfile.lock') {
bundlerVersion = readBundledWithFromGemfileLock() bundlerVersion = readBundledWithFromGemfileLock()
+1 -1
View File
@@ -16,7 +16,7 @@ export function getVersions(platform) {
], ],
"truffleruby": [ "truffleruby": [
"19.3.0", "19.3.1", "19.3.0", "19.3.1",
"20.0.0", "20.0.0", "20.1.0",
"head" "head"
] ]
} }
+15
View File
@@ -0,0 +1,15 @@
hash = File.read('ruby-builder-versions.js')[/\bversions = {[^}]+}/]
versions = eval hash
by_minor = versions[:ruby].group_by { |v| v[/^\d\.\d/] }
p by_minor['2.2']
p by_minor['2.3']
(4..7).each do |minor|
p by_minor["2.#{minor}"].map { |v| "ruby-#{v}" }
end
p (versions[:jruby] - %w[head]).map { |v| "jruby-#{v}" }
p (versions[:truffleruby] - %w[head]).map { |v| "truffleruby-#{v}" }