Compare commits

..
50 Commits
Author SHA1 Message Date
David Rodríguez d8d290d206 Add JRuby 9.2.11.0 2020-03-05 23:05:44 +02:00
Benoit Daloze 6044e83b8f Clarify about mingw and mswin
From https://github.com/ruby/setup-ruby/pull/24#issuecomment-590582731
2020-02-29 11:58:11 +01:00
MSP-Greg 970f6659fb Simplify 'tar' in ruby_builder.js - downloadAndExtract 2020-02-29 11:35:47 +01:00
MSP-Greg 01b616c294 ruby-builder.js - Win32 - use C:\Windows\system32\tar.exe 2020-02-28 17:59:58 +01:00
Benoit Daloze f010ae485f Merge the list in the README to render better on GitHub 2020-02-24 23:11:16 +01:00
Benoit Daloze 739b731933 Document mingw and mswin in the README 2020-02-24 23:03:49 +01:00
Benoit Daloze 0cbcadc627 Restore original spacing 2020-02-24 22:52:23 +01:00
Benoit Daloze 91a6c780c4 Reword comment 2020-02-24 22:52:23 +01:00
Benoit Daloze dbcdcf481d Simplify the logic to set up certs dir and cert.pem 2020-02-24 22:52:23 +01:00
Benoit Daloze d2b72024f1 Split ruby -v and compiler version
* It's not always gcc, can be e.g. clang too
2020-02-24 22:16:19 +01:00
Benoit Daloze 78fd200603 Reorder jobs to test in order of increasing version numbers 2020-02-24 22:15:24 +01:00
Benoit Daloze ca7fe3d91f Use consistent array indentation in YAML 2020-02-24 22:09:17 +01:00
Benoit Daloze de68645eec Trigger CI on PRs 2020-02-24 22:03:23 +01:00
MSP-Greg 20324f7e34 Add ruby-loco mingw and mswin
1. Add ruby-loco mingw and mswin
2. Split workflow jobs into common and specials
3. Adjust workflow for mswin - 'ridk version' & 'c extension' steps
2020-02-24 22:01:08 +01:00
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
Benoit Daloze f422c055c3 Add support for Ruby 2.2
* Use Ruby 2.2.6 from RubyInstaller on Windows since there is no more
  recent release of Ruby 2.2.
2020-02-06 15:20:13 +01:00
Benoit Daloze a01ba37375 Follow builder repositories transfers 2020-02-06 13:21:29 +01:00
Benoit Daloze fdfc519f55 Clarify the maintainer now that the repo moved 2020-02-06 13:18:40 +01:00
Benoit Daloze 480f78f4b6 Compare with actions/setup-ruby 2020-02-06 13:15:21 +01:00
Benoit Daloze 48efd73814 Follow repository transfer and rename 2020-02-06 13:09:38 +01:00
Benoit Daloze 5478747ea7 Add a line about the move and rename 2020-02-06 13:02:38 +01:00
Samuel Williams 8a173f1bc2 Change title to reflect new home. 2020-02-07 01:00:48 +13:00
Benoit Daloze 48481806ad Update to latest builds fixing "Insecure world writable dir" warnings
* Update to Rubinius 4.14 which fixes some segfaults.
2020-02-02 16:33:46 +01:00
Benoit Daloze 623e527949 Rename generate script 2020-02-02 13:23:31 +01:00
Benoit Daloze c933cecfdc Follow ruby-install-builder => ruby-builder repository rename 2020-02-02 13:21:37 +01:00
Benoit Daloze 7c15ff8590 Add info about the -head builders 2020-02-01 21:21:26 +01:00
Benoit Daloze 58366f2203 Reduce the test matrix as it's getting too large
* It was 40 checks and a lot of queuing on macOS.
* Version parsing is stable and can be tested more directly.
* 2.6.5 was tested twice: .ruby-version and explicitly.
2020-02-01 18:31:35 +01:00
Benoit Daloze f5483241db Add support for ruby-head 2020-02-01 18:22:53 +01:00
Benoit Daloze 0331c8b821 Add support for truffleruby-head 2020-02-01 15:17:12 +01:00
Benoit Daloze 818f4eeb16 The :required key is required is action.yml
* See https://help.github.com/en/actions/automating-your-workflow-with-github-actions/metadata-syntax-for-github-actions
2020-02-01 13:41:57 +01:00
Benoit Daloze 052cbd8ee4 Test bundle exec too 2020-01-30 23:24:13 +01:00
Benoit Daloze 001fd1b7c7 Document the choice of the drive on Windows 2020-01-30 22:17:19 +01:00
MSP-Greg 4d7199dbd0 Use SSD drive for Windows Ruby location 2020-01-30 22:15:28 +01:00
Benoit Daloze 5dd450999e Fix link to example 2020-01-25 18:19:48 +01:00
15 changed files with 465 additions and 197 deletions
+79 -14
View File
@@ -1,48 +1,113 @@
name: Test this action
on:
pull_request:
push:
branches-ignore:
- master
- v1
tags-ignore:
- '*'
paths-ignore:
- README.md
jobs:
test:
common:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ]
# 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, rubinius ]
ruby: [ 2.2, 2.3, .ruby-version, .tool-versions, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head ]
exclude:
- os: windows-latest
ruby: truffleruby
- os: ubuntu-16.04
ruby: rubinius
- os: macos-latest
ruby: rubinius
- os: windows-latest
ruby: rubinius
ruby: truffleruby-head
name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: ./
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby --version
- run: ridk version
if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3')
- run: ruby -v
- name: build compiler
run: |
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
- name: ridk version (mingw)
if: matrix.os == 'windows-latest'
run: |
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
if (($abi -ge '2.4') -and $plat.Contains('mingw')) {
ridk version
} else {
echo 'ridk is unavailable'
}
- name: Subprocess test
run: ruby test_subprocess.rb
- name: OpenSSL version
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION'
- name: OpenSSL test
run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }'
- name: C extension test
run: gem install json:2.2.0 --no-document
- name: Bundler version
run: bundle --version
- name: Bundler test
run: bundle install
- run: bundle --version
- run: bundle install
- run: bundle exec rake --version
specials:
strategy:
fail-fast: false
matrix:
cfg:
- { ruby: rubinius, os: ubuntu-18.04 }
- { ruby: mingw , os: windows-latest }
- { ruby: mswin , os: windows-latest }
name: ${{ matrix.cfg.os }} ${{ matrix.cfg.ruby }}
runs-on: ${{ matrix.cfg.os }}
steps:
- uses: actions/checkout@v2
- uses: ./
with:
ruby-version: ${{ matrix.cfg.ruby }}
- run: ruby -v
- name: build compiler
run: |
ruby -e "puts 'build compiler: ' + RbConfig::CONFIG.fetch('CC_VERSION_MESSAGE', 'unknown').lines.first"
- name: ridk version (mingw)
if: matrix.cfg.os == 'windows-latest'
run: |
$abi, $plat = $(ruby -e "STDOUT.write RbConfig::CONFIG['ruby_version'] + ' ' + RUBY_PLATFORM").split(' ')
if (($abi -ge '2.4') -and $plat.Contains('mingw')) {
ridk version
} else {
echo 'ridk is unavailable'
}
- name: Subprocess test
run: ruby test_subprocess.rb
- name: OpenSSL version
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION'
- name: OpenSSL test
run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }'
- name: C extension test
if: endsWith(matrix.cfg.ruby, 'mswin') == false
run: gem install json:2.2.0 --no-document
- name: C extension test (mswin cmd)
if: endsWith(matrix.cfg.ruby, 'mswin')
shell: cmd
run: |
call %VCVARS%
gem install json:2.2.0 --no-document
- name: C extension test (mswin ps1)
if: endsWith(matrix.cfg.ruby, 'mswin')
run: |
cmd.exe /c "$env:VCVARS && set" | Foreach-Object {
$p, $v = $_.split('=')
Set-Item -path env:$p -value $v
}
gem install json:2.2.0 --no-document
- run: bundle --version
- run: bundle install
- run: bundle exec rake --version
lint:
runs-on: ubuntu-latest
+2
View File
@@ -0,0 +1,2 @@
nodejs 12.0.0
ruby 2.7.0
+1
View File
@@ -1,5 +1,6 @@
# Used for testing
source 'https://rubygems.org'
gem "rake"
gem "path"
gem "json", "2.2.0"
+44 -16
View File
@@ -1,24 +1,32 @@
# use-ruby-action
# setup-ruby
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`.
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.
Compared to [actions/setup-ruby](https://github.com/actions/setup-ruby),
this actions supports many more versions and features.
### Supported Versions
This action currently supports these versions of MRI, JRuby and TruffleRuby:
| Interpreter | Versions |
| ----------- | -------- |
| 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 |
| JRuby | 9.2.9.0 |
| TruffleRuby | 19.3.0, 19.3.1 |
| Rubinius | 4.13 |
| 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, mingw, mswin |
| JRuby | 9.2.9.0 - 9.2.11.0, head |
| TruffleRuby | 19.3.0 - 20.0.0, head |
| Rubinius | 4.14 |
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, `mingw` and `mswin` are `ruby-head` builds using the MSYS2/MinGW and the MSVC toolchains respectively.
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.
Ruby 2.2 resolves to 2.2.6 on Windows (last build from RubyInstaller) and 2.2.10 otherwise.
### Supported Platforms
@@ -32,9 +40,13 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
Rubinius is only available on `ubuntu-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).
The full list of available Ruby versions can be seen in [ruby-install-builder-versions.js](ruby-install-builder-versions.js)
The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ruby-builder)
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
`mingw` and `mswin` builds are generated by [ruby-loco](https://github.com/MSP-Greg/ruby-loco).
`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)
for Ubuntu and macOS and in [windows-versions.js](windows-versions.js) for Windows.
## Usage
@@ -49,7 +61,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: eregon/use-ruby-action@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- run: ruby -v
@@ -72,7 +84,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: eregon/use-ruby-action@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby -v
@@ -84,7 +96,9 @@ jobs:
* 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
* 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
@@ -103,19 +117,32 @@ You can cache the installed gems with these two steps:
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby }}-
- name: Bundle install
- name: bundle install
run: |
bundle config path vendor/bundle
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 `.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).
The code above is a more complete version of the [Ruby - Gem example](https://github.com/actions/cache/blob/master/examples.md#ruby---gem).
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.
## 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
* This action currently only works with GitHub-hosted runners, not private runners.
@@ -127,5 +154,6 @@ This follows the [recommendations](https://github.com/actions/toolkit/blob/maste
## 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.
Many thanks to MSP-Greg and Lars Kanis for the help with Ruby Installer.
+2 -1
View File
@@ -7,7 +7,8 @@ branding:
inputs:
ruby-version:
description: 'Engine and version to use, see the syntax in the README. Reads from .ruby-version if unset.'
default: '.ruby-version'
required: false
default: 'default'
outputs:
ruby-prefix:
description: 'The prefix of the installed ruby'
Generated Vendored
+178 -101
View File
@@ -1000,7 +1000,7 @@ async function run() {
if (platform === 'windows-latest' && engine !== 'jruby') {
installer = __webpack_require__(826)
} else {
installer = __webpack_require__(442)
installer = __webpack_require__(489)
}
const engineVersions = installer.getAvailableVersions(platform, engine)
@@ -1014,13 +1014,28 @@ async function run() {
}
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
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
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
if (rubyVersion.match(/^\d+/)) { // X.Y.Z => ruby-X.Y.Z
if (rubyVersion.match(/^(\d+|head|mingw|mswin)/)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby'
version = rubyVersion
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
@@ -1040,13 +1055,13 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
if (!engineVersions.includes(version)) {
const latestToFirstVersion = engineVersions.slice().reverse()
const found = latestToFirstVersion.find(v => v.startsWith(version))
const found = latestToFirstVersion.find(v => v !== 'head' && v.startsWith(version))
if (found) {
version = found
} else {
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`)
File an issue at https://github.com/ruby/setup-ruby/issues if would like support for a new version`)
}
}
@@ -1356,6 +1371,46 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
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.2.10",
"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", "9.2.10.0", "9.2.11.0",
"head"
],
"truffleruby": [
"19.3.0", "19.3.1",
"20.0.0",
"head"
]
}
if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [
"4.14"
]
}
return versions
}
/***/ }),
/***/ 211:
@@ -3080,89 +3135,6 @@ function escape(s) {
}
//# 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 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 = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
console.log(url)
const downloadPath = await tc.downloadTool(url)
await tc.extractTar(downloadPath, rubiesDir)
return path.join(rubiesDir, ruby)
}
/***/ }),
/***/ 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"
],
"jruby": [
"9.2.9.0"
],
"truffleruby": [
"19.3.0", "19.3.1"
]
}
if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [
"4.13"
]
}
return versions
}
/***/ }),
/***/ 470:
@@ -3374,6 +3346,7 @@ exports.getState = getState;
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "versions", function() { return versions; });
const versions = {
"2.2.6": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.6-x64-mingw32.7z",
"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",
@@ -3397,7 +3370,77 @@ const versions = {
"2.6.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x64.7z",
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z",
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z",
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z"
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z",
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z"
}
/***/ }),
/***/ 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 exec = __webpack_require__(986)
const io = __webpack_require__(1)
const tc = __webpack_require__(533)
const rubyBuilderVersions = __webpack_require__(156)
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)
if (platform === 'windows-latest') {
__webpack_require__(826).setupPath(undefined, rubyPrefix)
} else {
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)
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
return path.join(rubiesDir, ruby)
}
function getDownloadURL(platform, ruby) {
if (ruby.endsWith('-head')) {
return getLatestHeadBuildURL(platform, ruby)
} else {
return `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
}
}
function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0]
return `https://github.com/ruby/${engine}-dev-builder/releases/latest/download/${engine}-head-${platform}.tar.gz`
}
@@ -4799,6 +4842,7 @@ module.exports = require("zlib");
__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; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setupPath", function() { return setupPath; });
// Most of this logic is from
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
@@ -4826,16 +4870,20 @@ async function install(platform, ruby) {
}
const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length)
// Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]
const downloadPath = await tc.downloadTool(url)
await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`)
const rubyPrefix = `C:\\${base}`
await exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${drive}:\\`], { silent: true })
const rubyPrefix = `${drive}:\\${base}`
const [hostedRuby, msys2] = await linkMSYS2()
const newPath = setupPath(msys2, rubyPrefix)
core.exportVariable('PATH', newPath)
setupPath((ruby === 'ruby-mswin' ? null : msys2), rubyPrefix)
if (version.startsWith('2.3')) {
if (version.startsWith('2.2') || version.startsWith('2.3')) {
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
} else if (version === 'mswin') {
setupMSWin(hostedRuby)
}
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
@@ -4845,6 +4893,25 @@ async function install(platform, ruby) {
return rubyPrefix
}
function setupMSWin(hostedRuby) {
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
if (!fs.existsSync(certsDir)) {
fs.mkdirSync(certsDir)
}
// Copy cert.pem from hosted Ruby
const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
if (!fs.existsSync(cert)) {
const hostedCert = `${hostedRuby}\\ssl\\cert.pem`
fs.copyFileSync(hostedCert, cert)
}
// Add a convenience VCVARS environment variable to ease setting up MSVC
// This assumes a single Visual Studio version being available in the windows-latest image
core.exportVariable('VCVARS', '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"')
}
async function linkMSYS2() {
const toolCacheVersions = tc.findAllVersions('Ruby')
toolCacheVersions.sort()
@@ -4856,26 +4923,36 @@ async function linkMSYS2() {
const hostedMSYS2 = `${latestHostedRuby}\\msys64`
const msys2 = 'C:\\msys64'
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
if (!fs.existsSync(msys2)) {
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
}
return [latestHostedRuby, msys2]
}
function setupPath(msys2, rubyPrefix) {
let path = process.env['PATH'].split(';')
// Remove conflicting dev tools from PATH
path = path.filter(e => !e.match(/\b(Chocolatey|CMake|mingw64|OpenSSL|Strawberry)\b/))
const originalPath = process.env['PATH'].split(';')
let path = originalPath.slice()
// Remove default Ruby in PATH
path = path.filter(e => !e.match(/\bRuby\b/))
// Add MSYS2 in PATH
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
if (msys2) {
// Add MSYS2 in PATH
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
}
// Add the downloaded Ruby in PATH
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)
}
@@ -2,6 +2,7 @@ require 'net/http'
require 'yaml'
require 'json'
min_version = '2.2.6'
url = 'https://raw.githubusercontent.com/oneclick/rubyinstaller.org-website/master/_data/downloads.yaml'
entries = YAML.load(Net::HTTP.get(URI(url)), symbolize_names: true)
@@ -18,10 +19,14 @@ versions = entries.select { |entry|
}.sort_by { |version, entry|
version
}.select { |version, entry|
version >= "2.3"
Gem::Version.new(version) >= Gem::Version.new(min_version)
}.map { |version, entry|
[version, entry[:href]]
}.to_h
versions['head'] = 'https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z'
versions['mingw'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z'
versions['mswin'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z'
js = "export const versions = #{JSON.pretty_generate(versions)}\n"
File.write 'windows-versions.js', js
+19 -4
View File
@@ -11,7 +11,7 @@ async function run() {
if (platform === 'windows-latest' && engine !== 'jruby') {
installer = require('./windows')
} else {
installer = require('./ruby-install-builder')
installer = require('./ruby-builder')
}
const engineVersions = installer.getAvailableVersions(platform, engine)
@@ -25,13 +25,28 @@ async function run() {
}
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
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
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
if (rubyVersion.match(/^\d+/)) { // X.Y.Z => ruby-X.Y.Z
if (rubyVersion.match(/^(\d+|head|mingw|mswin)/)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby'
version = rubyVersion
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
@@ -51,13 +66,13 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, version)
if (!engineVersions.includes(version)) {
const latestToFirstVersion = engineVersions.slice().reverse()
const found = latestToFirstVersion.find(v => v.startsWith(version))
const found = latestToFirstVersion.find(v => v !== 'head' && v.startsWith(version))
if (found) {
version = found
} else {
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`)
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",
"description": "Download a prebuilt Ruby and add it to the PATH in 5 seconds",
"main": "index.js",
@@ -9,7 +9,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/eregon/use-ruby-action.git"
"url": "git+https://github.com/ruby/setup-ruby.git"
},
"keywords": [
"GitHub",
@@ -19,9 +19,9 @@
"author": "Benoit Daloze",
"license": "MIT",
"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": {
"@actions/core": "^1.1.1",
"@actions/exec": "^1.0.1",
@@ -1,23 +1,28 @@
export function getVersions(platform) {
const versions = {
"ruby": [
"2.2.10",
"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"
"2.7.0",
"head"
],
"jruby": [
"9.2.9.0"
"9.2.9.0", "9.2.10.0", "9.2.11.0",
"head"
],
"truffleruby": [
"19.3.0", "19.3.1"
"19.3.0", "19.3.1",
"20.0.0",
"head"
]
}
if (platform === 'ubuntu-18.04') {
versions['rubinius'] = [
"4.13"
"4.14"
]
}
+56
View File
@@ -0,0 +1,56 @@
const os = require('os')
const path = require('path')
const core = require('@actions/core')
const exec = require('@actions/exec')
const io = require('@actions/io')
const tc = require('@actions/tool-cache')
const rubyBuilderVersions = require('./ruby-builder-versions')
const builderReleaseTag = 'builds-no-warn'
const releasesURL = 'https://github.com/ruby/ruby-builder/releases'
export function getAvailableVersions(platform, engine) {
return rubyBuilderVersions.getVersions(platform)[engine]
}
export async function install(platform, ruby) {
const rubyPrefix = await downloadAndExtract(platform, ruby)
if (platform === 'windows-latest') {
require('./windows').setupPath(undefined, rubyPrefix)
} else {
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)
const tar = platform.startsWith('windows') ? 'C:\\Windows\\system32\\tar.exe' : 'tar'
await exec.exec(tar, [ '-xz', '-C', rubiesDir, '-f', downloadPath ])
return path.join(rubiesDir, ruby)
}
function getDownloadURL(platform, ruby) {
if (ruby.endsWith('-head')) {
return getLatestHeadBuildURL(platform, ruby)
} else {
return `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
}
}
function getLatestHeadBuildURL(platform, ruby) {
const engine = ruby.split('-')[0]
return `https://github.com/ruby/${engine}-dev-builder/releases/latest/download/${engine}-head-${platform}.tar.gz`
}
-37
View File
@@ -1,37 +0,0 @@
const os = require('os')
const path = require('path')
const core = require('@actions/core')
const io = require('@actions/io')
const tc = require('@actions/tool-cache')
const rubyBuilderVersions = require('./ruby-install-builder-versions')
const builderReleaseTag = 'builds-newer-openssl'
const releasesURL = 'https://github.com/eregon/ruby-install-builder/releases'
export function getAvailableVersions(platform, engine) {
return rubyBuilderVersions.getVersions(platform)[engine]
}
export 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 = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
console.log(url)
const downloadPath = await tc.downloadTool(url)
await tc.extractTar(downloadPath, rubiesDir)
return path.join(rubiesDir, ruby)
}
+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?
+5 -1
View File
@@ -1,4 +1,5 @@
export const versions = {
"2.2.6": "https://dl.bintray.com/oneclick/rubyinstaller/ruby-2.2.6-x64-mingw32.7z",
"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",
@@ -22,5 +23,8 @@ export const versions = {
"2.6.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x64.7z",
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z",
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z",
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z"
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z",
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z"
}
+47 -14
View File
@@ -25,16 +25,20 @@ export async function install(platform, ruby) {
}
const base = url.slice(url.lastIndexOf('/') + 1, url.length - '.7z'.length)
// Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
const drive = (process.env['GITHUB_WORKSPACE'] || 'C')[0]
const downloadPath = await tc.downloadTool(url)
await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`)
const rubyPrefix = `C:\\${base}`
await exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${drive}:\\`], { silent: true })
const rubyPrefix = `${drive}:\\${base}`
const [hostedRuby, msys2] = await linkMSYS2()
const newPath = setupPath(msys2, rubyPrefix)
core.exportVariable('PATH', newPath)
setupPath((ruby === 'ruby-mswin' ? null : msys2), rubyPrefix)
if (version.startsWith('2.3')) {
if (version.startsWith('2.2') || version.startsWith('2.3')) {
core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`)
} else if (version === 'mswin') {
setupMSWin(hostedRuby)
}
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
@@ -44,6 +48,25 @@ export async function install(platform, ruby) {
return rubyPrefix
}
function setupMSWin(hostedRuby) {
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
if (!fs.existsSync(certsDir)) {
fs.mkdirSync(certsDir)
}
// Copy cert.pem from hosted Ruby
const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
if (!fs.existsSync(cert)) {
const hostedCert = `${hostedRuby}\\ssl\\cert.pem`
fs.copyFileSync(hostedCert, cert)
}
// Add a convenience VCVARS environment variable to ease setting up MSVC
// This assumes a single Visual Studio version being available in the windows-latest image
core.exportVariable('VCVARS', '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"')
}
async function linkMSYS2() {
const toolCacheVersions = tc.findAllVersions('Ruby')
toolCacheVersions.sort()
@@ -55,24 +78,34 @@ async function linkMSYS2() {
const hostedMSYS2 = `${latestHostedRuby}\\msys64`
const msys2 = 'C:\\msys64'
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
if (!fs.existsSync(msys2)) {
await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`)
}
return [latestHostedRuby, msys2]
}
function setupPath(msys2, rubyPrefix) {
let path = process.env['PATH'].split(';')
// Remove conflicting dev tools from PATH
path = path.filter(e => !e.match(/\b(Chocolatey|CMake|mingw64|OpenSSL|Strawberry)\b/))
export function setupPath(msys2, rubyPrefix) {
const originalPath = process.env['PATH'].split(';')
let path = originalPath.slice()
// Remove default Ruby in PATH
path = path.filter(e => !e.match(/\bRuby\b/))
// Add MSYS2 in PATH
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
if (msys2) {
// Add MSYS2 in PATH
path.unshift(`${msys2}\\mingw64\\bin`, `${msys2}\\usr\\bin`)
}
// Add the downloaded Ruby in PATH
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)
}