Compare commits

..
17 Commits
Author SHA1 Message Date
Benoit Daloze 7f508b5101 Add JRuby 9.2.10.0 2020-02-22 15:34:51 +01:00
Benoit Daloze 94fe02071e Add reference for jruby-head builds in README 2020-02-22 13:45:57 +01:00
Benoit Daloze d81cbeb0ce Clarify it's recommended to update to ruby/setup-ruby 2020-02-19 13:42:20 +01:00
Benoit Daloze 06ab568b6a Add TruffleRuby 20.0.0 2020-02-18 21:53:04 +01:00
Benoit Daloze d186982201 Clean yarn.lock 2020-02-17 21:26:24 +01:00
Juanito Fatas d649a291c3 Add suggestion when run on single platform 2020-02-17 14:58:58 +01:00
Benoit Daloze cdeaf534b7 Use more concise job names 2020-02-16 16:45:43 +01:00
Benoit Daloze 3197025b07 Add support for jruby-head 2020-02-16 16:39:10 +01:00
Benoit Daloze 28def02321 Use the automatic latest release asset link for head builds 2020-02-16 16:30:22 +01:00
Benoit Daloze 3d6280ad19 Add support for .tool-versions 2020-02-16 14:49:55 +01:00
Benoit Daloze 980126329a where.exe needs to be used in PowerShell
* See https://stackoverflow.com/a/304447/388803
2020-02-16 13:00:27 +01:00
Benoit Daloze 4f28d1c82e Add notes about Windows in the README 2020-02-09 23:51:09 +01:00
Benoit Daloze 53b22d2360 Don't run CI twice when merging to master
* It already ran on the feature branch.
2020-02-09 23:38:56 +01:00
Benoit Daloze 55dff253ca Do not remove any dev tools from PATH on Windows
* This might lead to more conflicts, but the flip side of a setup action
  removing capabilities seems worse and unexpected.
* See https://github.com/ruby/setup-ruby/issues/19
2020-02-09 23:38:26 +01:00
Benoit Daloze e15ecc8aaa Print entries removed from PATH on Windows 2020-02-09 23:37:52 +01:00
Benoit Daloze 71f024b642 Silence the output of 7z on Windows
* It's quite verbose (22 lines) and there is no quiet flag.
2020-02-09 23:37:52 +01:00
Benoit Daloze 30011b6444 Cleanup PATH for JRuby on Windows
* That way we remove the default Ruby in PATH which was confusing.
2020-02-08 22:14:50 +01:00
11 changed files with 125 additions and 3388 deletions
+4 -2
View File
@@ -2,6 +2,7 @@ name: Test this action
on: on:
push: push:
branches-ignore: branches-ignore:
- master
- v1 - v1
tags-ignore: tags-ignore:
- '*' - '*'
@@ -14,7 +15,7 @@ jobs:
matrix: matrix:
os: [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ] os: [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ]
# Use various version syntaxes here for testing # Use various version syntaxes here for testing
ruby: [ .ruby-version, 2.2, 2.3, 2.7.0, ruby-head, jruby, truffleruby, truffleruby-head, rubinius ] ruby: [ .ruby-version, .tool-versions, 2.2, 2.3, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, rubinius ]
exclude: exclude:
- os: windows-latest - os: windows-latest
ruby: truffleruby ruby: truffleruby
@@ -26,6 +27,7 @@ jobs:
ruby: rubinius ruby: rubinius
- os: windows-latest - os: windows-latest
ruby: rubinius ruby: rubinius
name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -34,7 +36,7 @@ jobs:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
- run: ruby --version - run: ruby --version
- run: ridk version - run: ridk version
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3') && !startsWith(matrix.ruby, '2.2') if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, 'jruby') && !startsWith(matrix.ruby, '2.3') && !startsWith(matrix.ruby, '2.2')
- name: Subprocess test - name: Subprocess test
run: ruby test_subprocess.rb run: ruby test_subprocess.rb
- name: OpenSSL version - name: OpenSSL version
+2
View File
@@ -0,0 +1,2 @@
nodejs 12.0.0
ruby 2.7.0
+25 -5
View File
@@ -1,6 +1,7 @@
# setup-ruby # setup-ruby
Note: this action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization. Note: this action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.
Please [update](https://github.com/ruby/setup-ruby/releases/tag/v1.13.0) if you are using `eregon/use-ruby-action`.
This action downloads a prebuilt ruby and adds it to the `PATH`. This action downloads a prebuilt ruby and adds it to the `PATH`.
@@ -17,8 +18,8 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
| Interpreter | Versions | | Interpreter | Versions |
| ----------- | -------- | | ----------- | -------- |
| Ruby | 2.2, 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.2, 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 - 9.2.10.0, head |
| TruffleRuby | 19.3.0, 19.3.1, head | | TruffleRuby | 19.3.0 - 20.0.0, head |
| Rubinius | 4.14 | | 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,
@@ -40,7 +41,9 @@ Rubinius is only available on `ubuntu-latest`.
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).
`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). `ruby-head` is generated by [ruby-dev-builder](https://github.com/ruby/ruby-dev-builder),
`jruby-head` is generated by [jruby-dev-builder](https://github.com/ruby/jruby-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) 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.
@@ -91,7 +94,11 @@ jobs:
* short version like `2.6`, automatically using the latest release matching that version (`2.6.5`) * short version like `2.6`, automatically using the latest release matching that version (`2.6.5`)
* version only like `2.6.5`, assumes MRI for the engine * version only like `2.6.5`, assumes MRI for the engine
* engine only like `truffleruby`, uses the latest stable release of that implementation * engine only like `truffleruby`, uses the latest stable release of that implementation
* `.ruby-version` (also the default value) reads from the project's `.ruby-version` file
* `.ruby-version` reads from the project's `.ruby-version` file
* `.tool-versions` reads from the project's `.tool-versions` file
* If the `ruby-version` input is not specified, `.ruby-version` is tried first, followed by `.tool-versions`
### Bundler ### Bundler
@@ -116,13 +123,26 @@ You can cache the installed gems with these two steps:
bundle install --jobs 4 --retry 3 bundle install --jobs 4 --retry 3
``` ```
When using a single OS, replace `${{ matrix.os }}` with the OS.
When using a single job with a Ruby version, replace `${{ matrix.ruby }}` with the Ruby version. When using a single job with a Ruby version, replace `${{ matrix.ruby }}` with the Ruby version.
When using `.ruby-version`, replace `${{ matrix.ruby }}` with `${{ hashFiles('.ruby-version') }}`. When using `.ruby-version`, replace `${{ matrix.ruby }}` with `${{ hashFiles('.ruby-version') }}`.
When using `.tool-versions`, replace `${{ matrix.ruby }}` with `${{ hashFiles('.tool-versions') }}`.
This uses the [cache action](https://github.com/actions/cache). This uses the [cache action](https://github.com/actions/cache).
The code above is a more complete version of the [Ruby - Bundler example](https://github.com/actions/cache/blob/master/examples.md#ruby---bundler). The code above is a more complete version of the [Ruby - Bundler example](https://github.com/actions/cache/blob/master/examples.md#ruby---bundler).
Make sure to include `use-ruby` in the `key` to avoid conflicting with previous caches. Make sure to include `use-ruby` in the `key` to avoid conflicting with previous caches.
## Windows
Note that running CI on Windows can be quite challenging if you are not very familiar with Windows.
It is recommended to first get your build working on Ubuntu and macOS before trying Windows.
* The default shell on Windows is not Bash but [PowerShell](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell).
This can lead issues such as multi-line scripts [not working as expected](https://github.com/ruby/setup-ruby/issues/13).
* The `PATH` contains [multiple compiler toolchains](https://github.com/ruby/setup-ruby/issues/19). Use `where.exe` to debug which tool is used.
* MSYS2 is prepended to the `PATH`, similar to what RubyInstaller2 does.
* JRuby on Windows has a known bug that `bundle exec rake` [fails](https://github.com/ruby/setup-ruby/issues/18).
## Limitations ## Limitations
* This action currently only works with GitHub-hosted runners, not private runners. * This action currently only works with GitHub-hosted runners, not private runners.
+1 -1
View File
@@ -8,7 +8,7 @@ inputs:
ruby-version: ruby-version:
description: 'Engine and version to use, see the syntax in the README. Reads from .ruby-version if unset.' description: 'Engine and version to use, see the syntax in the README. Reads from .ruby-version if unset.'
required: false required: false
default: '.ruby-version' default: 'default'
outputs: outputs:
ruby-prefix: ruby-prefix:
description: 'The prefix of the installed ruby' description: 'The prefix of the installed ruby'
Generated Vendored
+46 -3327
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -25,9 +25,24 @@ async function run() {
} }
function parseRubyEngineAndVersion(rubyVersion) { function parseRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === 'default') {
if (fs.existsSync('.ruby-version')) {
rubyVersion = '.ruby-version'
} else if (fs.existsSync('.tool-versions')) {
rubyVersion = '.tool-versions'
} else {
throw new Error('input ruby-version needs to be specified if no .ruby-version or .tool-versions file exists')
}
}
if (rubyVersion === '.ruby-version') { // Read from .ruby-version if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim() rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
console.log(`Using ${rubyVersion} as input from file .ruby-version`) console.log(`Using ${rubyVersion} as input from file .ruby-version`)
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
const rubyLine = toolVersions.split(/\r?\n/).filter(e => e.match(/^ruby\s/))[0]
rubyVersion = rubyLine.split(/\s+/, 2)[1]
console.log(`Using ${rubyVersion} as input from file .tool-versions`)
} }
let engine, version let engine, version
+1 -2
View File
@@ -26,8 +26,7 @@
"@actions/core": "^1.1.1", "@actions/core": "^1.1.1",
"@actions/exec": "^1.0.1", "@actions/exec": "^1.0.1",
"@actions/io": "^1.0.1", "@actions/io": "^1.0.1",
"@actions/tool-cache": "^1.1.2", "@actions/tool-cache": "^1.1.2"
"axios": "^0.19.0"
}, },
"devDependencies": { "devDependencies": {
"@zeit/ncc": "^0.20.5", "@zeit/ncc": "^0.20.5",
+3 -1
View File
@@ -10,10 +10,12 @@ export function getVersions(platform) {
"head" "head"
], ],
"jruby": [ "jruby": [
"9.2.9.0" "9.2.9.0", "9.2.10.0",
"head"
], ],
"truffleruby": [ "truffleruby": [
"19.3.0", "19.3.1", "19.3.0", "19.3.1",
"20.0.0",
"head" "head"
] ]
} }
+10 -13
View File
@@ -4,7 +4,6 @@ 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-builder-versions') const rubyBuilderVersions = require('./ruby-builder-versions')
const axios = require('axios')
const builderReleaseTag = 'builds-no-warn' const builderReleaseTag = 'builds-no-warn'
const releasesURL = 'https://github.com/ruby/ruby-builder/releases' const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
@@ -16,9 +15,13 @@ export function getAvailableVersions(platform, 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(path.join(rubyPrefix, 'bin')) if (platform === 'windows-latest') {
if (ruby.startsWith('rubinius')) { require('./windows').setupPath(undefined, rubyPrefix)
core.addPath(path.join(rubyPrefix, 'gems', 'bin')) } else {
core.addPath(path.join(rubyPrefix, 'bin'))
if (ruby.startsWith('rubinius')) {
core.addPath(path.join(rubyPrefix, 'gems', 'bin'))
}
} }
return rubyPrefix return rubyPrefix
@@ -37,7 +40,7 @@ async function downloadAndExtract(platform, ruby) {
return path.join(rubiesDir, ruby) return path.join(rubiesDir, ruby)
} }
async function getDownloadURL(platform, ruby) { function getDownloadURL(platform, ruby) {
if (ruby.endsWith('-head')) { if (ruby.endsWith('-head')) {
return getLatestHeadBuildURL(platform, ruby) return getLatestHeadBuildURL(platform, ruby)
} else { } else {
@@ -45,13 +48,7 @@ async function getDownloadURL(platform, ruby) {
} }
} }
async function getLatestHeadBuildURL(platform, ruby) { function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0] const engine = ruby.split('-')[0]
const repository = `ruby/${engine}-dev-builder` return `https://github.com/ruby/${engine}-dev-builder/releases/latest/download/${engine}-head-${platform}.tar.gz`
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`
} }
+18 -11
View File
@@ -29,12 +29,11 @@ export async function install(platform, ruby) {
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)
await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -o${drive}:\\`) await exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${drive}:\\`], { silent: true })
const rubyPrefix = `${drive}:\\${base}` const rubyPrefix = `${drive}:\\${base}`
const [hostedRuby, msys2] = await linkMSYS2() const [hostedRuby, msys2] = await linkMSYS2()
const newPath = setupPath(msys2, rubyPrefix) setupPath(msys2, rubyPrefix)
core.exportVariable('PATH', newPath)
if (version.startsWith('2.2') || version.startsWith('2.3')) { if (version.startsWith('2.2') || version.startsWith('2.3')) {
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`) core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
@@ -62,20 +61,28 @@ async function linkMSYS2() {
return [latestHostedRuby, msys2] return [latestHostedRuby, msys2]
} }
function setupPath(msys2, rubyPrefix) { export function setupPath(msys2, rubyPrefix) {
let path = process.env['PATH'].split(';') const originalPath = process.env['PATH'].split(';')
let path = originalPath.slice()
// Remove conflicting dev tools from PATH
path = path.filter(e => !e.match(/\b(Chocolatey|CMake|mingw64|OpenSSL|Strawberry)\b/))
// Remove default Ruby in PATH // Remove default Ruby in PATH
path = path.filter(e => !e.match(/\bRuby\b/)) path = path.filter(e => !e.match(/\bRuby\b/))
// Add MSYS2 in PATH if (msys2) {
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`) // Add MSYS2 in PATH
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
}
// Add the downloaded Ruby in PATH // Add the downloaded Ruby in PATH
path.unshift(`${rubyPrefix}\\bin`) path.unshift(`${rubyPrefix}\\bin`)
return path.join(';') console.log("Entries removed from PATH to avoid conflicts with Ruby:")
for (const entry of originalPath) {
if (!path.includes(entry)) {
console.log(entry)
}
}
const newPath = path.join(';')
core.exportVariable('PATH', newPath)
} }
Generated
-26
View File
@@ -108,13 +108,6 @@ astral-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==
axios@^0.19.0:
version "0.19.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
dependencies:
follow-redirects "1.5.10"
balanced-match@^1.0.0: balanced-match@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
@@ -187,13 +180,6 @@ cross-spawn@^6.0.5:
shebang-command "^1.2.0" shebang-command "^1.2.0"
which "^1.2.9" which "^1.2.9"
debug@=3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
dependencies:
ms "2.0.0"
debug@^4.0.1: debug@^4.0.1:
version "4.1.1" version "4.1.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
@@ -381,13 +367,6 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
follow-redirects@1.5.10:
version "1.5.10"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
dependencies:
debug "=3.1.0"
fs.realpath@^1.0.0: fs.realpath@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -578,11 +557,6 @@ mkdirp@^0.5.1:
dependencies: dependencies:
minimist "0.0.8" minimist "0.0.8"
ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=
ms@^2.1.1: ms@^2.1.1:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"