mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea86920b92 | ||
|
|
a43803ce44 | ||
|
|
bf8b766096 | ||
|
|
44338c51c7 | ||
|
|
037dfa7b6b | ||
|
|
6647273ce9 | ||
|
|
071acb9122 | ||
|
|
ba5b846810 | ||
|
|
81be0938f7 |
+17
-11
@@ -8,25 +8,31 @@ on:
|
|||||||
- '*'
|
- '*'
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- README.md
|
- README.md
|
||||||
|
schedule:
|
||||||
|
- cron: '0 7 * * SUN'
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu, macos, windows ]
|
os: [ ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-10.15, windows-2016, windows-2019 ]
|
||||||
# Use various version syntax here for testing
|
# Use various version syntax here for testing
|
||||||
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
|
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, debug, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
|
||||||
include:
|
include:
|
||||||
- { os: ubuntu, ruby: rubinius }
|
- { os: ubuntu-18.04, ruby: rubinius }
|
||||||
- { os: windows, ruby: mingw }
|
- { os: windows-2016, ruby: mingw }
|
||||||
- { os: windows, ruby: mswin }
|
- { os: windows-2019, ruby: mingw }
|
||||||
|
- { os: windows-2019, ruby: mswin }
|
||||||
exclude:
|
exclude:
|
||||||
- { os: windows, ruby: debug }
|
- { os: windows-2016, ruby: debug }
|
||||||
- { os: windows, ruby: truffleruby }
|
- { os: windows-2016, ruby: truffleruby }
|
||||||
- { os: windows, ruby: truffleruby-head }
|
- { os: windows-2016, ruby: truffleruby-head }
|
||||||
|
- { os: windows-2019, ruby: debug }
|
||||||
|
- { os: windows-2019, ruby: truffleruby }
|
||||||
|
- { os: windows-2019, ruby: truffleruby-head }
|
||||||
|
|
||||||
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
name: ${{ matrix.os }} ${{ matrix.ruby }}
|
||||||
runs-on: ${{ matrix.os }}-latest
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
@@ -39,7 +45,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
|
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
|
||||||
- name: gcc and ridk version (mingw)
|
- name: gcc and ridk version (mingw)
|
||||||
if: matrix.os == 'windows'
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
|
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
|
||||||
if ($plat.Contains('mingw')) {
|
if ($plat.Contains('mingw')) {
|
||||||
@@ -65,10 +71,10 @@ jobs:
|
|||||||
- run: bundle exec rake --version
|
- run: bundle exec rake --version
|
||||||
|
|
||||||
- name: which ruby, rake
|
- name: which ruby, rake
|
||||||
if: matrix.os != 'windows'
|
if: "!startsWith(matrix.os, 'windows')"
|
||||||
run: which -a ruby rake
|
run: which -a ruby rake
|
||||||
- name: where ruby, rake
|
- name: where ruby, rake
|
||||||
if: matrix.os == 'windows'
|
if: startsWith(matrix.os, 'windows')
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Continue'
|
$ErrorActionPreference = 'Continue'
|
||||||
$where = 'ruby', 'rake'
|
$where = 'ruby', 'rake'
|
||||||
|
|||||||
@@ -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`).
|
||||||
@@ -33,13 +33,13 @@ On Windows, Ruby 2.4 uses OpenSSL 1.0.2, which is no longer maintained.
|
|||||||
|
|
||||||
The action works for all [GitHub-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners).
|
The action works for all [GitHub-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners).
|
||||||
|
|
||||||
| Operating System | Versions |
|
| Operating System | Recommended | Other Supported Versions |
|
||||||
| ----------- | -------- |
|
| ----------- | -------- | -------- |
|
||||||
| Ubuntu | `ubuntu-latest` (= `ubuntu-18.04`), `ubuntu-16.04` |
|
| Ubuntu | `ubuntu-latest` (= `ubuntu-18.04`) | `ubuntu-20.04`, `ubuntu-16.04` |
|
||||||
| macOS | `macos-latest` |
|
| macOS | `macos-latest` (= `macos-10.15`) | |
|
||||||
| Windows | `windows-latest` |
|
| Windows | `windows-latest` (= `windows-2019`) | `windows-2016` |
|
||||||
|
|
||||||
Rubinius is only available on `ubuntu-latest`.
|
Rubinius is only available on `ubuntu-18.04`.
|
||||||
|
|
||||||
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-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).
|
||||||
@@ -121,7 +121,7 @@ This behavior can be customized, see [action.yml](action.yml) for details about
|
|||||||
You can cache the installed gems with these two steps:
|
You can cache the installed gems with these two steps:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: vendor/bundle
|
path: vendor/bundle
|
||||||
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||||
|
|||||||
@@ -42,3 +42,12 @@ function findUbuntuVersion() {
|
|||||||
throw new Error('Could not find Ubuntu version')
|
throw new Error('Could not find Ubuntu version')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||||
|
export function win2nix(path) {
|
||||||
|
if (/^[A-Z]:/i.test(path)) {
|
||||||
|
// path starts with drive
|
||||||
|
path = `/${path[0].toLowerCase()}${path.split(':', 2)[1]}`
|
||||||
|
}
|
||||||
|
return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
|
||||||
|
}
|
||||||
|
|||||||
+41
-12
@@ -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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1508,6 +1521,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measure", function() { return measure; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "measure", function() { return measure; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHeadVersion", function() { return isHeadVersion; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHeadVersion", function() { return isHeadVersion; });
|
||||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVirtualEnvironmentName", function() { return getVirtualEnvironmentName; });
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getVirtualEnvironmentName", function() { return getVirtualEnvironmentName; });
|
||||||
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "win2nix", function() { return win2nix; });
|
||||||
const os = __webpack_require__(87)
|
const os = __webpack_require__(87)
|
||||||
const fs = __webpack_require__(747)
|
const fs = __webpack_require__(747)
|
||||||
const core = __webpack_require__(470)
|
const core = __webpack_require__(470)
|
||||||
@@ -1553,6 +1567,15 @@ function findUbuntuVersion() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
|
||||||
|
function win2nix(path) {
|
||||||
|
if (/^[A-Z]:/i.test(path)) {
|
||||||
|
// path starts with drive
|
||||||
|
path = `/${path[0].toLowerCase()}${path.split(':', 2)[1]}`
|
||||||
|
}
|
||||||
|
return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@@ -3569,9 +3592,15 @@ async function downloadAndExtract(platform, engine, version) {
|
|||||||
return await tc.downloadTool(url)
|
return await tc.downloadTool(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
await common.measure('Extracting Ruby', async () => {
|
||||||
await common.measure('Extracting Ruby', async () =>
|
if (process.env.ImageOS === 'win16') {
|
||||||
exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ]))
|
const tar = '"C:\\Program Files\\Git\\usr\\bin\\tar.exe"'
|
||||||
|
await exec.exec(tar, [ '-xz', '-C', common.win2nix(rubiesDir), '-f', common.win2nix(downloadPath) ])
|
||||||
|
} else {
|
||||||
|
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||||
|
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return path.join(rubiesDir, `${engine}-${version}`)
|
return path.join(rubiesDir, `${engine}-${version}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-3
@@ -34,9 +34,15 @@ async function downloadAndExtract(platform, engine, version) {
|
|||||||
return await tc.downloadTool(url)
|
return await tc.downloadTool(url)
|
||||||
})
|
})
|
||||||
|
|
||||||
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
await common.measure('Extracting Ruby', async () => {
|
||||||
await common.measure('Extracting Ruby', async () =>
|
if (process.env.ImageOS === 'win16') {
|
||||||
exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ]))
|
const tar = '"C:\\Program Files\\Git\\usr\\bin\\tar.exe"'
|
||||||
|
await exec.exec(tar, [ '-xz', '-C', common.win2nix(rubiesDir), '-f', common.win2nix(downloadPath) ])
|
||||||
|
} else {
|
||||||
|
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
|
||||||
|
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return path.join(rubiesDir, `${engine}-${version}`)
|
return path.join(rubiesDir, `${engine}-${version}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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}" }
|
||||||
Reference in New Issue
Block a user