Compare commits

...
41 Commits
Author SHA1 Message Date
Benoit Daloze 8f312efe12 Fix typo 2022-01-13 19:47:00 +01:00
Benoit Daloze 26470672e5 Small cleanups 2022-01-13 19:40:03 +01:00
MSP-Greg fb94cfb62e yarn run package 2022-01-13 19:25:34 +01:00
MSP-Greg f51e04d8c5 package.json & yarn.lock - @vercel/ncc: 0.28.6 -> 0.31.1 2022-01-13 19:25:34 +01:00
MSP-Greg e9c1c1bf40 windows.js - add hasMSYS2PreInstalled constant 2022-01-13 19:25:34 +01:00
MSP-Greg 24d6deea38 Windows JRuby - install MinGW tools, typo 2022-01-13 19:25:34 +01:00
MSP-Greg 3b96304b91 windows.js - suggested changes 2022-01-13 19:25:34 +01:00
MSP-Greg 18485596cf Windows - Rename 3rd party OpenSSL SYSTEM32 dll's 2022-01-13 19:25:34 +01:00
MSP-Greg 70ec766ec5 Actions - add windows-2022 jobs 2022-01-13 19:25:34 +01:00
MSP-Greg ffd46bd1d2 Only install mingw or ucrt for new Rubies 2022-01-13 19:25:34 +01:00
MSP-Greg 480fe921a2 windows.js - update addVCVARSEnv to work with all windows images 2022-01-13 19:25:34 +01:00
MSP-Greg 4fbcf63963 Install MSYS2 tools before gcc tools, clear pacman database folder 2022-01-13 19:25:34 +01:00
MSP-Greg 66308367ad log output - all 'ing', align 2022-01-13 19:25:34 +01:00
MSP-Greg b0aab3e1cf Add ruby-loco ucrt build 2022-01-13 19:25:34 +01:00
MSP-GregandLars Kanis 23b44d8ec5 Use ridk enable to set MSYS2 ENV variables
Co-authored-by: Lars Kanis <lars@greiz-reinsdorf.de>
2022-01-13 19:25:34 +01:00
MSP-Greg 6cc535991c Actions - Add Windows-2022 with ruby-head & ruby-mingw 2022-01-13 19:25:34 +01:00
MSP-Greg 226c4cceaa Add Windows MSYS2 ucrt and Windows-2022 support 2022-01-13 19:25:34 +01:00
Benoit Daloze 4726835508 Try 'gem install --force bundler' on 3.1 Windows 2022-01-10 17:52:23 +01:00
Koichi ITO bee16c98fd Support Ruby 3.1.0 for Windows
Follow up to https://github.com/oneclick/rubyinstaller2/issues/255#issuecomment-1003266597.

This PR adds Ruby 3.1.0 to windows-version.js.
2022-01-10 17:52:23 +01:00
Benoit Daloze 168d6a54b4 Remove 2.5 from example as it is EOL 2021-12-26 19:21:10 +01:00
shmokmt f0971f0dd4 Add Ruby 3.1.0 2021-12-26 19:21:10 +01:00
Benoit Daloze 471466b54c Add JRuby 9.2.20.1 and 9.3.2.0 2021-12-07 11:22:34 +01:00
Benoit Daloze be0cc84c1b Add 2.6.9, 2.7.5 and 3.0.3 on Windows 2021-11-30 19:19:02 +01:00
aparna-ravindra e7eea4e63a using actions/cache version 1.0.8 2021-11-30 15:18:35 +01:00
Ryan Laughlin bb8200704b Update CONTRIBUTING.md 2021-11-26 17:35:31 +01:00
Bertrand Paquet cf1a6dd2d8 Also add 2.6.9 and 2.7.5 2021-11-24 19:20:49 +01:00
Bertrand Paquet 5b2e10fa5f Add ruby 3.0.3 2021-11-24 19:20:49 +01:00
Benoit Daloze 313811148f Previews are not available on Windows 2021-11-24 19:19:52 +01:00
Jankees van Woezik 74cfbf0614 Clarify the use of ImageOs on self hosted runners 2021-11-24 18:57:32 +01:00
Benoit Daloze f20f1eae72 Test 3.1 too 2021-11-11 13:19:00 +01:00
Brian Kephart 330f7f5faa Add Ruby 3.1.0-preview1 2021-11-11 13:18:51 +01:00
Benoit Daloze a2b2637a7c Add JRuby 9.2.20.0 2021-11-07 15:20:50 +01:00
Benoit Daloze e5b2d1fb1e Document how to add a new Ruby version 2021-11-07 15:20:29 +01:00
Benoit Daloze b00551441a Add TruffleRuby and TruffleRuby GraalVM 2021-10-19 19:07:24 +02:00
Pavel Rosický f514fbcdac Add JRuby 9.3.1.0 2021-10-14 12:22:08 +02:00
Benoit Daloze a6f2286594 Use the proper ABI version for caching gems of truffleruby-head
* Previously the commit was used.
2021-10-05 16:57:38 +02:00
Benoit Daloze c84889b9b9 TruffleRuby correctly changes the ABI version now 2021-10-05 16:51:03 +02:00
Benoit Daloze ac03cb7d18 Use .test() instead of .match() where possible 2021-09-25 13:45:43 +02:00
Benoit Daloze 5e4f0a10bf Add JRuby 9.3.0.0
* Fixes https://github.com/ruby/setup-ruby/issues/220
2021-09-25 12:42:44 +02:00
Benoit Daloze 57d46d78b7 Installing libxml2-dev libxslt-dev is only needed on TruffleRuby < 21.1
* TruffleRuby >= 21.1 installs nokogiri with the packaged libxml2/libxslt
  like on CRuby by default. See https://github.com/oracle/truffleruby/issues/62
2021-08-07 20:08:38 +02:00
Benoit Daloze 7edf159e98 Add support for truffleruby+graalvm
* Using ruby-build to avoid duplicating too much logic.
2021-08-07 20:05:23 +02:00
14 changed files with 540 additions and 157 deletions
+14 -2
View File
@@ -15,21 +15,33 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ] os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019, windows-2022 ]
ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', ruby-head, jruby, jruby-head, truffleruby, truffleruby-head ] ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
include: include:
- { os: windows-2016, ruby: mingw } - { os: windows-2016, ruby: mingw }
- { os: windows-2019, ruby: mingw } - { os: windows-2019, ruby: mingw }
- { os: windows-2019, ruby: mswin } - { os: windows-2019, ruby: mswin }
- { os: windows-2022, ruby: mingw }
- { os: windows-2022, ruby: ucrt }
exclude: exclude:
- { os: windows-2016, ruby: 1.9 } - { os: windows-2016, ruby: 1.9 }
- { os: windows-2016, ruby: debug } - { os: windows-2016, ruby: debug }
- { os: windows-2016, ruby: truffleruby } - { os: windows-2016, ruby: truffleruby }
- { os: windows-2016, ruby: truffleruby-head } - { os: windows-2016, ruby: truffleruby-head }
- { os: windows-2016, ruby: truffleruby+graalvm }
- { os: windows-2016, ruby: truffleruby+graalvm-head }
- { os: windows-2019, ruby: 1.9 } - { os: windows-2019, ruby: 1.9 }
- { os: windows-2019, ruby: debug } - { os: windows-2019, ruby: debug }
- { os: windows-2019, ruby: truffleruby } - { os: windows-2019, ruby: truffleruby }
- { os: windows-2019, ruby: truffleruby-head } - { os: windows-2019, ruby: truffleruby-head }
- { os: windows-2019, ruby: truffleruby+graalvm }
- { os: windows-2019, ruby: truffleruby+graalvm-head }
- { os: windows-2022, ruby: 1.9 }
- { os: windows-2022, ruby: debug }
- { os: windows-2022, ruby: truffleruby }
- { os: windows-2022, ruby: truffleruby-head }
- { os: windows-2022, ruby: truffleruby+graalvm }
- { os: windows-2022, ruby: truffleruby+graalvm-head }
name: ${{ matrix.os }} ${{ matrix.ruby }} name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
+4
View File
@@ -19,3 +19,7 @@ It is recommended to add this as a `git` `pre-commit` hook:
```bash ```bash
$ cp pre-commit .git/hooks/pre-commit $ cp pre-commit .git/hooks/pre-commit
``` ```
## Adding a new Ruby version
Add the new version in `ruby-builder-versions.js`, then follow the steps above in [Regenerating dist/index.js](#regenerating-distindexjs) to update `dist/index.js`. Finally, update the "Supported Versions" section of the README if needed.
+10 -6
View File
@@ -14,9 +14,10 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
| Interpreter | Versions | | Interpreter | Versions |
| ----------- | -------- | | ----------- | -------- |
| `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.0.2, head, debug, mingw, mswin | | `ruby` | 1.9.3, 2.0.0, 2.1.9, 2.2, all versions from 2.3.0 until 3.1.0, head, debug, mingw, mswin |
| `jruby` | 9.1.17.0, 9.2.9.0 - 9.2.19.0, head | | `jruby` | 9.1.17.0 - 9.3.2.0, head |
| `truffleruby` | 19.3.0 - 21.2.0.1, head | | `truffleruby` | 19.3.0 - 21.3.0, head |
| `truffleruby+graalvm` | 21.2.0 - 21.3.0, head |
`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`).
On Windows, `mingw` and `mswin` are `ruby-head` builds using the MSYS2/MinGW and the MSVC toolchains respectively. On Windows, `mingw` and `mswin` are `ruby-head` builds using the MSYS2/MinGW and the MSVC toolchains respectively.
@@ -46,8 +47,9 @@ The prebuilt releases are generated by [ruby-builder](https://github.com/ruby/ru
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2). 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). `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), `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) `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). `truffleruby-head` is generated by [truffleruby-dev-builder](https://github.com/ruby/truffleruby-dev-builder)
and `truffleruby+graalvm` is generated by [graalvm-ce-dev-builds](https://github.com/graalvm/graalvm-ce-dev-builds).
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.
@@ -84,7 +86,7 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: [2.5, 2.6, 2.7, '3.0', head, jruby, jruby-head, truffleruby, truffleruby-head] ruby: [2.6, 2.7, '3.0', 3.1, head, jruby, jruby-head, truffleruby, truffleruby-head]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -241,6 +243,8 @@ if the [virtual environment](https://github.com/actions/virtual-environments) is
In other cases, please use a system Ruby or [install Ruby manually](https://github.com/postmodern/chruby/wiki#installing-rubies) instead. In other cases, please use a system Ruby or [install Ruby manually](https://github.com/postmodern/chruby/wiki#installing-rubies) instead.
On a self-hosted runner you need to define the `ImageOs` as an evironment variable on the host, you can do this in the `~/actions-runner/.env` file (See [#230](https://github.com/ruby/setup-ruby/issues/230)).
## History ## History
This action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization. This action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.
+25 -19
View File
@@ -40,12 +40,12 @@ function readBundledWithFromGemfileLock(lockFile) {
return null return null
} }
async function afterLockFile(lockFile, platform, engine) { async function afterLockFile(lockFile, platform, engine, rubyVersion) {
if (engine === 'truffleruby' && platform.startsWith('ubuntu-')) { if (engine.startsWith('truffleruby') && common.floatVersion(rubyVersion) < 21.1 && platform.startsWith('ubuntu-')) {
const contents = fs.readFileSync(lockFile, 'utf8') const contents = fs.readFileSync(lockFile, 'utf8')
if (contents.includes('nokogiri')) { if (contents.includes('nokogiri')) {
await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby', async () => await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby < 21.1', async () =>
exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true })) exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true }))
} }
} }
} }
@@ -74,7 +74,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) { if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2') console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) { } else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1') console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same } else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
@@ -86,12 +86,14 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
// Avoid installing a newer Bundler version for head versions as it might not work. // Avoid installing a newer Bundler version for head versions as it might not work.
// For releases, even if they ship with Bundler 2 we install the latest Bundler. // For releases, even if they ship with Bundler 2 we install the latest Bundler.
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) { } else if (engine.startsWith('truffleruby') && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}` const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) // Workaround for https://github.com/rubygems/rubygems/issues/5245
const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : []
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
} }
return bundlerVersion return bundlerVersion
@@ -126,7 +128,7 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
await exec.exec('bundle', ['lock'], envOptions) await exec.exec('bundle', ['lock'], envOptions)
} }
await afterLockFile(lockFile, platform, engine) await afterLockFile(lockFile, platform, engine, rubyVersion)
// cache key // cache key
const paths = [cachePath] const paths = [cachePath]
@@ -183,17 +185,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
if (engine !== 'jruby' && common.isHeadVersion(version)) { if (common.isHeadVersion(version)) {
let revision = ''; if (engine !== 'jruby') {
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
silent: true, let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
listeners: { let abi = ''
stdout: (data) => { await exec.exec('ruby', ['-e', print_abi], {
revision += data.toString(); silent: true,
listeners: {
stdout: (data) => {
abi += data.toString();
}
} }
} });
}); key += `-ABI-${abi}`
key += `-revision-${revision}` }
} }
key += `-${lockFile}` key += `-${lockFile}`
+15 -3
View File
@@ -48,7 +48,7 @@ export async function measure(name, block) {
} }
export function isHeadVersion(rubyVersion) { export function isHeadVersion(rubyVersion) {
return rubyVersion === 'head' || rubyVersion === 'debug' || rubyVersion === 'mingw' || rubyVersion === 'mswin' return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
} }
export function isStableVersion(rubyVersion) { export function isStableVersion(rubyVersion) {
@@ -62,7 +62,7 @@ export function isBundler1Default(engine, rubyVersion) {
export function isBundler2Default(engine, rubyVersion) { export function isBundler2Default(engine, rubyVersion) {
if (engine === 'ruby') { if (engine === 'ruby') {
return floatVersion(rubyVersion) >= 2.7 return floatVersion(rubyVersion) >= 2.7
} else if (engine === 'truffleruby') { } else if (engine.startsWith('truffleruby')) {
return floatVersion(rubyVersion) >= 21.0 return floatVersion(rubyVersion) >= 21.0
} else if (engine === 'jruby') { } else if (engine === 'jruby') {
return floatVersion(rubyVersion) >= 9.3 return floatVersion(rubyVersion) >= 9.3
@@ -155,7 +155,15 @@ export function win2nix(path) {
return path.replace(/\\/g, '/').replace(/ /g, '\\ ') return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
} }
// JRuby is installed after setupPath is called, so folder doesn't exist
function rubyIsUCRT(path) {
return !!(fs.existsSync(path) &&
fs.readdirSync(path, { withFileTypes: true }).find(dirent =>
dirent.isFile() && dirent.name.match(/^x64-ucrt-ruby\d{3}\.dll$/)))
}
export function setupPath(newPathEntries) { export function setupPath(newPathEntries) {
let msys2Type = null
const envPath = windows ? 'Path' : 'PATH' const envPath = windows ? 'Path' : 'PATH'
const originalPath = process.env[envPath].split(path.delimiter) const originalPath = process.env[envPath].split(path.delimiter)
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry)) let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
@@ -176,8 +184,11 @@ export function setupPath(newPathEntries) {
// Then add new path entries using core.addPath() // Then add new path entries using core.addPath()
let newPath let newPath
if (windows) { if (windows) {
// main Ruby dll determines whether mingw or ucrt build
msys2Type = rubyIsUCRT(newPathEntries[0]) ? 'ucrt64' : 'mingw64'
// add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain // add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain
const msys2 = ['C:\\msys64\\mingw64\\bin', 'C:\\msys64\\usr\\bin'] const msys2 = [`C:\\msys64\\${msys2Type}\\bin`, 'C:\\msys64\\usr\\bin']
newPath = [...newPathEntries, ...msys2] newPath = [...newPathEntries, ...msys2]
} else { } else {
newPath = newPathEntries newPath = newPathEntries
@@ -189,4 +200,5 @@ export function setupPath(newPathEntries) {
core.endGroup() core.endGroup()
core.addPath(newPath.join(path.delimiter)) core.addPath(newPath.join(path.delimiter))
return msys2Type
} }
Generated Vendored
+276 -88
View File
@@ -54,12 +54,12 @@ function readBundledWithFromGemfileLock(lockFile) {
return null return null
} }
async function afterLockFile(lockFile, platform, engine) { async function afterLockFile(lockFile, platform, engine, rubyVersion) {
if (engine === 'truffleruby' && platform.startsWith('ubuntu-')) { if (engine.startsWith('truffleruby') && common.floatVersion(rubyVersion) < 21.1 && platform.startsWith('ubuntu-')) {
const contents = fs.readFileSync(lockFile, 'utf8') const contents = fs.readFileSync(lockFile, 'utf8')
if (contents.includes('nokogiri')) { if (contents.includes('nokogiri')) {
await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby', async () => await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby < 21.1', async () =>
exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true })) exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true }))
} }
} }
} }
@@ -88,7 +88,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) { if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2') console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) { } else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1') console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
bundlerVersion = '1' bundlerVersion = '1'
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same } else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
@@ -100,12 +100,14 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
// Avoid installing a newer Bundler version for head versions as it might not work. // Avoid installing a newer Bundler version for head versions as it might not work.
// For releases, even if they ship with Bundler 2 we install the latest Bundler. // For releases, even if they ship with Bundler 2 we install the latest Bundler.
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) { } else if (engine.startsWith('truffleruby') && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}` const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) // Workaround for https://github.com/rubygems/rubygems/issues/5245
const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : []
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
} }
return bundlerVersion return bundlerVersion
@@ -140,7 +142,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
await exec.exec('bundle', ['lock'], envOptions) await exec.exec('bundle', ['lock'], envOptions)
} }
await afterLockFile(lockFile, platform, engine) await afterLockFile(lockFile, platform, engine, rubyVersion)
// cache key // cache key
const paths = [cachePath] const paths = [cachePath]
@@ -197,17 +199,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
if (engine !== 'jruby' && common.isHeadVersion(version)) { if (common.isHeadVersion(version)) {
let revision = ''; if (engine !== 'jruby') {
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
silent: true, let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
listeners: { let abi = ''
stdout: (data) => { await exec.exec('ruby', ['-e', print_abi], {
revision += data.toString(); silent: true,
listeners: {
stdout: (data) => {
abi += data.toString();
}
} }
} });
}); key += `-ABI-${abi}`
key += `-revision-${revision}` }
} }
key += `-${lockFile}` key += `-${lockFile}`
@@ -290,7 +296,7 @@ async function measure(name, block) {
} }
function isHeadVersion(rubyVersion) { function isHeadVersion(rubyVersion) {
return rubyVersion === 'head' || rubyVersion === 'debug' || rubyVersion === 'mingw' || rubyVersion === 'mswin' return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion)
} }
function isStableVersion(rubyVersion) { function isStableVersion(rubyVersion) {
@@ -304,7 +310,7 @@ function isBundler1Default(engine, rubyVersion) {
function isBundler2Default(engine, rubyVersion) { function isBundler2Default(engine, rubyVersion) {
if (engine === 'ruby') { if (engine === 'ruby') {
return floatVersion(rubyVersion) >= 2.7 return floatVersion(rubyVersion) >= 2.7
} else if (engine === 'truffleruby') { } else if (engine.startsWith('truffleruby')) {
return floatVersion(rubyVersion) >= 21.0 return floatVersion(rubyVersion) >= 21.0
} else if (engine === 'jruby') { } else if (engine === 'jruby') {
return floatVersion(rubyVersion) >= 9.3 return floatVersion(rubyVersion) >= 9.3
@@ -397,7 +403,15 @@ function win2nix(path) {
return path.replace(/\\/g, '/').replace(/ /g, '\\ ') return path.replace(/\\/g, '/').replace(/ /g, '\\ ')
} }
// JRuby is installed after setupPath is called, so folder doesn't exist
function rubyIsUCRT(path) {
return !!(fs.existsSync(path) &&
fs.readdirSync(path, { withFileTypes: true }).find(dirent =>
dirent.isFile() && dirent.name.match(/^x64-ucrt-ruby\d{3}\.dll$/)))
}
function setupPath(newPathEntries) { function setupPath(newPathEntries) {
let msys2Type = null
const envPath = windows ? 'Path' : 'PATH' const envPath = windows ? 'Path' : 'PATH'
const originalPath = process.env[envPath].split(path.delimiter) const originalPath = process.env[envPath].split(path.delimiter)
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry)) let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
@@ -418,8 +432,11 @@ function setupPath(newPathEntries) {
// Then add new path entries using core.addPath() // Then add new path entries using core.addPath()
let newPath let newPath
if (windows) { if (windows) {
// main Ruby dll determines whether mingw or ucrt build
msys2Type = rubyIsUCRT(newPathEntries[0]) ? 'ucrt64' : 'mingw64'
// add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain // add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain
const msys2 = ['C:\\msys64\\mingw64\\bin', 'C:\\msys64\\usr\\bin'] const msys2 = [`C:\\msys64\\${msys2Type}\\bin`, 'C:\\msys64\\usr\\bin']
newPath = [...newPathEntries, ...msys2] newPath = [...newPathEntries, ...msys2]
} else { } else {
newPath = newPathEntries newPath = newPathEntries
@@ -431,6 +448,7 @@ function setupPath(newPathEntries) {
core.endGroup() core.endGroup()
core.addPath(newPath.join(path.delimiter)) core.addPath(newPath.join(path.delimiter))
return msys2Type
} }
@@ -532,7 +550,7 @@ function restoreCache(paths, primaryKey, restoreKeys, options) {
if (core.isDebug()) { if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod); yield tar_1.listTar(archivePath, compressionMethod);
} }
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath); const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`); core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
yield tar_1.extractTar(archivePath, compressionMethod); yield tar_1.extractTar(archivePath, compressionMethod);
core.info('Cache restored successfully'); core.info('Cache restored successfully');
@@ -577,18 +595,29 @@ function saveCache(paths, key, options) {
const archiveFolder = yield utils.createTempDirectory(); const archiveFolder = yield utils.createTempDirectory();
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod)); const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`); core.debug(`Archive Path: ${archivePath}`);
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod); try {
if (core.isDebug()) { yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
yield tar_1.listTar(archivePath, compressionMethod); if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod);
}
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
if (archiveFileSize > fileSizeLimit) {
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
}
core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
} }
const fileSizeLimit = 5 * 1024 * 1024 * 1024; // 5GB per repo limit finally {
const archiveFileSize = utils.getArchiveFileSizeIsBytes(archivePath); // Try to delete the archive to save space
core.debug(`File Size: ${archiveFileSize}`); try {
if (archiveFileSize > fileSizeLimit) { yield utils.unlinkFile(archivePath);
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 5GB limit, not saving cache.`); }
catch (error) {
core.debug(`Failed to delete archive: ${error}`);
}
} }
core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
return cacheId; return cacheId;
}); });
} }
@@ -756,7 +785,7 @@ function uploadChunk(httpClient, resourceUrl, openStream, start, end) {
function uploadFile(httpClient, cacheId, archivePath, options) { function uploadFile(httpClient, cacheId, archivePath, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Upload Chunks // Upload Chunks
const fileSize = fs.statSync(archivePath).size; const fileSize = utils.getArchiveFileSizeInBytes(archivePath);
const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`);
const fd = fs.openSync(archivePath, 'r'); const fd = fs.openSync(archivePath, 'r');
const uploadOptions = options_1.getUploadOptions(options); const uploadOptions = options_1.getUploadOptions(options);
@@ -806,7 +835,7 @@ function saveCache(cacheId, archivePath, options) {
yield uploadFile(httpClient, cacheId, archivePath, options); yield uploadFile(httpClient, cacheId, archivePath, options);
// Commit Cache // Commit Cache
core.debug('Commiting cache'); core.debug('Commiting cache');
const cacheSize = utils.getArchiveFileSizeIsBytes(archivePath); const cacheSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`); core.info(`Cache Size: ~${Math.round(cacheSize / (1024 * 1024))} MB (${cacheSize} B)`);
const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize); const commitCacheResponse = yield commitCache(httpClient, cacheId, cacheSize);
if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) { if (!requestUtils_1.isSuccessStatusCode(commitCacheResponse.statusCode)) {
@@ -886,10 +915,10 @@ function createTempDirectory() {
}); });
} }
exports.createTempDirectory = createTempDirectory; exports.createTempDirectory = createTempDirectory;
function getArchiveFileSizeIsBytes(filePath) { function getArchiveFileSizeInBytes(filePath) {
return fs.statSync(filePath).size; return fs.statSync(filePath).size;
} }
exports.getArchiveFileSizeIsBytes = getArchiveFileSizeIsBytes; exports.getArchiveFileSizeInBytes = getArchiveFileSizeInBytes;
function resolvePaths(patterns) { function resolvePaths(patterns) {
var e_1, _a; var e_1, _a;
var _b; var _b;
@@ -1194,7 +1223,7 @@ function downloadCacheHttpClient(archiveLocation, archivePath) {
const contentLengthHeader = downloadResponse.message.headers['content-length']; const contentLengthHeader = downloadResponse.message.headers['content-length'];
if (contentLengthHeader) { if (contentLengthHeader) {
const expectedLength = parseInt(contentLengthHeader); const expectedLength = parseInt(contentLengthHeader);
const actualLength = utils.getArchiveFileSizeIsBytes(archivePath); const actualLength = utils.getArchiveFileSizeInBytes(archivePath);
if (actualLength !== expectedLength) { if (actualLength !== expectedLength) {
throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`); throw new Error(`Incomplete download. Expected file size: ${expectedLength}, actual file size: ${actualLength}`);
} }
@@ -58770,20 +58799,26 @@ function getVersions(platform) {
"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.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.4.10", "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.4.10",
"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.5.8", "2.5.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.5.8", "2.5.9",
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8", "2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8", "2.6.9",
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", "2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", "2.7.5",
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2", "3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2", "3.0.3",
"head", "debug", "3.1.0-preview1", "3.1.0",
"head", "debug"
], ],
"jruby": [ "jruby": [
"9.1.17.0", "9.1.17.0",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.20.0", "9.2.20.1",
"9.3.0.0", "9.3.1.0", "9.3.2.0",
"head" "head"
], ],
"truffleruby": [ "truffleruby": [
"19.3.0", "19.3.1", "19.3.0", "19.3.1",
"20.0.0", "20.1.0", "20.2.0", "20.3.0", "20.0.0", "20.1.0", "20.2.0", "20.3.0",
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.3.0",
"head"
],
"truffleruby+graalvm": [
"21.2.0", "21.3.0",
"head" "head"
] ]
} }
@@ -58840,19 +58875,43 @@ async function install(platform, engine, version) {
common.setupPath([path.join(rubyPrefix, 'bin')]) common.setupPath([path.join(rubyPrefix, 'bin')])
if (!inToolCache) { if (!inToolCache) {
await downloadAndExtract(platform, engine, version, rubyPrefix); await preparePrefix(rubyPrefix)
if (engine === 'truffleruby+graalvm') {
await installWithRubyBuild(engine, version, rubyPrefix)
} else {
await downloadAndExtract(platform, engine, version, rubyPrefix)
}
} }
return rubyPrefix return rubyPrefix
} }
async function downloadAndExtract(platform, engine, version, rubyPrefix) { async function preparePrefix(rubyPrefix) {
const parentDir = path.dirname(rubyPrefix) const parentDir = path.dirname(rubyPrefix)
await io.rmRF(rubyPrefix) await io.rmRF(rubyPrefix)
if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) { if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) {
await io.mkdirP(parentDir) await io.mkdirP(parentDir)
} }
}
async function installWithRubyBuild(engine, version, rubyPrefix) {
const tmp = process.env['RUNNER_TEMP'] || os.tmpdir()
const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')
await common.measure('Cloning ruby-build', async () => {
await exec.exec('git', ['clone', 'https://github.com/rbenv/ruby-build.git', rubyBuildDir])
})
const rubyName = `${engine}-${version === 'head' ? 'dev' : version}`
await common.measure(`Installing ${engine}-${version} with ruby-build`, async () => {
await exec.exec(`${rubyBuildDir}/bin/ruby-build`, [rubyName, rubyPrefix])
})
await io.rmRF(rubyBuildDir)
}
async function downloadAndExtract(platform, engine, version, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix)
const downloadPath = await common.measure('Downloading Ruby', async () => { const downloadPath = await common.measure('Downloading Ruby', async () => {
const url = getDownloadURL(platform, engine, version) const url = getDownloadURL(platform, engine, version)
@@ -58860,7 +58919,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
return await tc.downloadTool(url) return await tc.downloadTool(url)
}) })
await common.measure('Extracting Ruby', async () => { await common.measure('Extracting Ruby', async () => {
if (windows) { if (windows) {
// Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths // Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths
await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)]) await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)])
@@ -58936,17 +58995,22 @@ const versions = {
"2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-2/rubyinstaller-2.6.6-2-x64.7z", "2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-2/rubyinstaller-2.6.6-2-x64.7z",
"2.6.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.7-1/rubyinstaller-2.6.7-1-x64.7z", "2.6.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.7-1/rubyinstaller-2.6.7-1-x64.7z",
"2.6.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.8-1/rubyinstaller-2.6.8-1-x64.7z", "2.6.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.8-1/rubyinstaller-2.6.8-1-x64.7z",
"2.6.9": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-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",
"2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z", "2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z",
"2.7.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-2.7.2-1-x64.7z", "2.7.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-2.7.2-1-x64.7z",
"2.7.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.3-1/rubyinstaller-2.7.3-1-x64.7z", "2.7.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.3-1/rubyinstaller-2.7.3-1-x64.7z",
"2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z", "2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z",
"2.7.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.5-1/rubyinstaller-2.7.5-1-x64.7z",
"3.0.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.7z", "3.0.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.7z",
"3.0.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.1-1/rubyinstaller-3.0.1-1-x64.7z", "3.0.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.1-1/rubyinstaller-3.0.1-1-x64.7z",
"3.0.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.2-1/rubyinstaller-3.0.2-1-x64.7z", "3.0.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.2-1/rubyinstaller-3.0.2-1-x64.7z",
"3.0.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.3-1/rubyinstaller-3.0.3-1-x64.7z",
"3.1.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z",
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-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", "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" "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z",
"ucrt": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z"
} }
@@ -58960,6 +59024,7 @@ __nccwpck_require__.r(__webpack_exports__);
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, { /* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
/* harmony export */ "getAvailableVersions": () => (/* binding */ getAvailableVersions), /* harmony export */ "getAvailableVersions": () => (/* binding */ getAvailableVersions),
/* harmony export */ "install": () => (/* binding */ install), /* harmony export */ "install": () => (/* binding */ install),
/* harmony export */ "installJRubyTools": () => (/* binding */ installJRubyTools),
/* harmony export */ "addVCVARSEnv": () => (/* binding */ addVCVARSEnv) /* harmony export */ "addVCVARSEnv": () => (/* binding */ addVCVARSEnv)
/* harmony export */ }); /* harmony export */ });
// Most of this logic is from // Most of this logic is from
@@ -58977,12 +59042,16 @@ const rubyInstallerVersions = __nccwpck_require__(7223)/* .versions */ .d
const drive = common.drive const drive = common.drive
const msys2BasePath = 'C:\\msys64'
// needed for 2.0-2.3, and mswin, cert file used by Git for Windows // needed for 2.0-2.3, and mswin, cert file used by Git for Windows
const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
// location & path for old RubyInstaller DevKit (MSYS), Ruby 2.0-2.3 // location & path for old RubyInstaller DevKit (MSYS1), Ruby 2.0-2.3
const msys = `${drive}:\\DevKit64` const msys1 = `${drive}:\\DevKit64`
const msysPathEntries = [`${msys}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys}\\mingw\\bin`, `${msys}\\bin`] const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
const virtualEnv = common.getVirtualEnvironmentName()
function getAvailableVersions(platform, engine) { function getAvailableVersions(platform, engine) {
if (engine === 'ruby') { if (engine === 'ruby') {
@@ -58995,6 +59064,10 @@ function getAvailableVersions(platform, engine) {
async function install(platform, engine, version) { async function install(platform, engine, version) {
const url = rubyInstallerVersions[version] const url = rubyInstallerVersions[version]
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
// and MinGW build tools installed. The windows-2022 image has neither.
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv)
if (!url.endsWith('.7z')) { if (!url.endsWith('.7z')) {
throw new Error(`URL should end in .7z: ${url}`) throw new Error(`URL should end in .7z: ${url}`)
} }
@@ -59014,15 +59087,71 @@ async function install(platform, engine, version) {
let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version) let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version)
common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
if (!inToolCache) { if (!inToolCache) {
await downloadAndExtract(engine, version, url, base, rubyPrefix); await downloadAndExtract(engine, version, url, base, rubyPrefix);
} }
const msys2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
// install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
if (!hasMSYS2PreInstalled) {
await installMSYS2Tools()
}
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
// ucrt64 or mingw64 installed, depending on Ruby version
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
await installGCCTools(msys2Type)
}
const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
if (fs.existsSync(ridk)) {
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
}
return rubyPrefix return rubyPrefix
} }
// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
async function installGCCTools(type) {
const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => {
let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/${type}.7z`
console.log(url)
return await tc.downloadTool(url)
})
await common.measure(`Extracting ${type} build tools`, async () =>
// -aoa overwrite existing, -bd disable progress indicator
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
}
// Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it.
// A subset of the MSYS2 base-devel group
async function installMSYS2Tools() {
const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => {
let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z`
console.log(url)
return await tc.downloadTool(url)
})
// need to remove all directories, since they may indicate old packages are installed,
// otherwise, error of "error: duplicated database entry"
fs.rmdirSync(`${msys2BasePath}\\var\\lib\\pacman\\local`, { recursive: true, force: true })
await common.measure(`Extracting msys2 build tools`, async () =>
// -aoa overwrite existing, -bd disable progress indicator
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
}
// Windows JRuby can install gems that require compile tools, only needed for
// windows-2022 and later images
async function installJRubyTools() {
await installMSYS2Tools()
await installGCCTools('mingw64')
}
async function downloadAndExtract(engine, version, url, base, rubyPrefix) { async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix) const parentDir = path.dirname(rubyPrefix)
@@ -59031,8 +59160,9 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
return await tc.downloadTool(url) return await tc.downloadTool(url)
}) })
await common.measure('Extracting Ruby', async () => await common.measure('Extracting Ruby', async () =>
exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) // -bd disable progress indicator, -xr extract but exclude share\doc files
exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true }))
if (base !== path.basename(rubyPrefix)) { if (base !== path.basename(rubyPrefix)) {
await io.mv(path.join(parentDir, base), rubyPrefix) await io.mv(path.join(parentDir, base), rubyPrefix)
@@ -59046,23 +59176,29 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
async function setupMingw(version) { async function setupMingw(version) {
core.exportVariable('MAKE', 'make.exe') core.exportVariable('MAKE', 'make.exe')
// rename these to avoid confusion when Ruby is using OpenSSL 1.0.2.
// most current extconf files look for 1.1.x dll files first, which is the version of the renamed files
if (common.floatVersion(version) <= 2.4) {
renameSystem32Dlls()
}
if (common.floatVersion(version) <= 2.3) { if (common.floatVersion(version) <= 2.3) {
core.exportVariable('SSL_CERT_FILE', certFile) core.exportVariable('SSL_CERT_FILE', certFile)
await common.measure('Installing MSYS', async () => installMSYS(version)) await common.measure('Installing MSYS1', async () => installMSYS1(version))
return msysPathEntries return msysPathEntries
} else { } else {
return [] return []
} }
} }
// Ruby 2.0, 2.1, 2.2 and 2.3 // Ruby 2.0-2.3
async function installMSYS(version) { async function installMSYS1(version) {
const url = 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' const url = 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'
const downloadPath = await tc.downloadTool(url) const downloadPath = await tc.downloadTool(url)
await exec.exec('7z', ['x', downloadPath, `-o${msys}`], { silent: true }) await exec.exec('7z', ['x', downloadPath, `-o${msys1}`], { silent: true })
// below are set in the old devkit.rb file ? // below are set in the old devkit.rb file ?
core.exportVariable('RI_DEVKIT', msys) core.exportVariable('RI_DEVKIT', msys1)
core.exportVariable('CC' , 'gcc') core.exportVariable('CC' , 'gcc')
core.exportVariable('CXX', 'g++') core.exportVariable('CXX', 'g++')
core.exportVariable('CPP', 'cpp') core.exportVariable('CPP', 'cpp')
@@ -59090,15 +59226,28 @@ async function setupMSWin() {
/* Sets MSVC environment for use in Actions /* Sets MSVC environment for use in Actions
* allows steps to run without running vcvars*.bat, also for PowerShell * allows steps to run without running vcvars*.bat, also for PowerShell
* adds a convenience VCVARS environment variable * adds a convenience VCVARS environment variable
* this assumes a single Visual Studio version being available in the windows-latest image */ * this assumes a single Visual Studio version being available in the Windows images */
function addVCVARSEnv() { function addVCVARSEnv() {
const vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' let vcVars = ''
switch (virtualEnv) {
case 'windows-2016':
vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
case 'windows-2019':
vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
case 'windows-2022':
vcVars = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
default:
throw new Error(`Unknown Windows Image: ${virtualEnv}`)
}
core.exportVariable('VCVARS', vcVars) core.exportVariable('VCVARS', vcVars)
let newEnv = new Map() let newEnv = new Map()
let cmd = `cmd.exe /c "${vcVars} && set"` let cmd = `cmd.exe /c "${vcVars} && set"`
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/) let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
newSet = newSet.filter(line => line.match(/\S=\S/)) newSet = newSet.filter(line => /\S=\S/.test(line))
newSet.forEach(s => { newSet.forEach(s => {
let [k,v] = common.partition(s, '=') let [k,v] = common.partition(s, '=')
newEnv.set(k,v) newEnv.set(k,v)
@@ -59118,6 +59267,36 @@ function addVCVARSEnv() {
return newPathEntries return newPathEntries
} }
// ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from build folder due to dll resolution
function renameSystem32Dlls() {
const sys32 = 'C:\\Windows\\System32\\'
const badFiles = [`${sys32}libcrypto-1_1-x64.dll`, `${sys32}libssl-1_1-x64.dll`]
const existing = badFiles.filter((dll) => fs.existsSync(dll))
console.log(`Renaming ${existing.join(' and ')} to avoid dll resolution conflicts on Ruby <= 2.4`)
existing.forEach(dll => fs.renameSync(dll, `${dll}_`))
}
// Sets MSYS2 ENV variables set from running `ridk enable`
function addRidkEnv(ridk) {
let newEnv = new Map()
let cmd = `cmd.exe /c "${ridk} enable && set"`
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
newSet = newSet.filter(line => /^\S+=\S+/.test(line))
newSet.forEach(s => {
let [k, v] = common.partition(s, '=')
newEnv.set(k, v)
})
for (let [k, v] of newEnv) {
if (process.env[k] !== v) {
if (!/^Path$/i.test(k)) {
console.log(`${k}=${v}`)
core.exportVariable(k, v)
}
}
}
}
/***/ }), /***/ }),
@@ -59149,7 +59328,7 @@ module.exports = JSON.parse('["ac","com.ac","edu.ac","gov.ac","net.ac","mil.ac",
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("assert");; module.exports = require("assert");
/***/ }), /***/ }),
@@ -59157,7 +59336,7 @@ module.exports = require("assert");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("buffer");; module.exports = require("buffer");
/***/ }), /***/ }),
@@ -59165,7 +59344,7 @@ module.exports = require("buffer");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("child_process");; module.exports = require("child_process");
/***/ }), /***/ }),
@@ -59173,7 +59352,7 @@ module.exports = require("child_process");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("crypto");; module.exports = require("crypto");
/***/ }), /***/ }),
@@ -59181,7 +59360,7 @@ module.exports = require("crypto");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("events");; module.exports = require("events");
/***/ }), /***/ }),
@@ -59189,7 +59368,7 @@ module.exports = require("events");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("fs");; module.exports = require("fs");
/***/ }), /***/ }),
@@ -59197,7 +59376,7 @@ module.exports = require("fs");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("http");; module.exports = require("http");
/***/ }), /***/ }),
@@ -59205,7 +59384,7 @@ module.exports = require("http");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("https");; module.exports = require("https");
/***/ }), /***/ }),
@@ -59213,7 +59392,7 @@ module.exports = require("https");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("net");; module.exports = require("net");
/***/ }), /***/ }),
@@ -59221,7 +59400,7 @@ module.exports = require("net");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("os");; module.exports = require("os");
/***/ }), /***/ }),
@@ -59229,7 +59408,7 @@ module.exports = require("os");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("path");; module.exports = require("path");
/***/ }), /***/ }),
@@ -59237,7 +59416,7 @@ module.exports = require("path");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("perf_hooks");; module.exports = require("perf_hooks");
/***/ }), /***/ }),
@@ -59245,7 +59424,7 @@ module.exports = require("perf_hooks");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("punycode");; module.exports = require("punycode");
/***/ }), /***/ }),
@@ -59253,7 +59432,7 @@ module.exports = require("punycode");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("stream");; module.exports = require("stream");
/***/ }), /***/ }),
@@ -59261,7 +59440,7 @@ module.exports = require("stream");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("string_decoder");; module.exports = require("string_decoder");
/***/ }), /***/ }),
@@ -59269,7 +59448,7 @@ module.exports = require("string_decoder");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("timers");; module.exports = require("timers");
/***/ }), /***/ }),
@@ -59277,7 +59456,7 @@ module.exports = require("timers");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("tls");; module.exports = require("tls");
/***/ }), /***/ }),
@@ -59285,7 +59464,7 @@ module.exports = require("tls");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("url");; module.exports = require("url");
/***/ }), /***/ }),
@@ -59293,7 +59472,7 @@ module.exports = require("url");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("util");; module.exports = require("util");
/***/ }), /***/ }),
@@ -59301,7 +59480,7 @@ module.exports = require("util");;
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = require("zlib");; module.exports = require("zlib");
/***/ }) /***/ })
@@ -59368,7 +59547,9 @@ module.exports = require("zlib");;
/******/ /******/
/******/ /* webpack/runtime/compat */ /******/ /* webpack/runtime/compat */
/******/ /******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";
/******/
/************************************************************************/
var __webpack_exports__ = {}; var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => { (() => {
@@ -59431,6 +59612,13 @@ async function setupRuby(options = {}) {
createGemRC(engine, version) createGemRC(engine, version)
envPreInstall() envPreInstall()
// JRuby can use compiled extension code, so make sure gcc exists.
// As of Jan-2022, JRuby compiles against msvcrt.
if (platform.startsWith('windows') && (engine === 'jruby') &&
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
await __nccwpck_require__(3216).installJRubyTools()
}
const rubyPrefix = await installer.install(platform, engine, version) const rubyPrefix = await installer.install(platform, engine, version)
// When setup-ruby is used by other actions, this allows code in them to run // When setup-ruby is used by other actions, this allows code in them to run
@@ -59444,11 +59632,11 @@ async function setupRuby(options = {}) {
const [gemfile, lockFile] = bundler.detectGemfiles() const [gemfile, lockFile] = bundler.detectGemfiles()
const bundlerVersion = await common.measure('Installing Bundler', async () => const bundlerVersion = await common.measure('Installing Bundler', async () =>
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version)) bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
if (inputs['bundler-cache'] === 'true') { if (inputs['bundler-cache'] === 'true') {
await common.measure('bundle install', async () => await common.measure('bundle install', async () =>
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
} }
} }
@@ -59471,13 +59659,13 @@ function parseRubyEngineAndVersion(rubyVersion) {
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 } else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim() const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
const rubyLine = toolVersions.split(/\r?\n/).filter(e => e.match(/^ruby\s/))[0] const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1] rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
console.log(`Using ${rubyVersion} as input from file .tool-versions`) console.log(`Using ${rubyVersion} as input from file .tool-versions`)
} }
let engine, version let engine, version
if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z if (/^(\d+)/.test(rubyVersion) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby' engine = 'ruby'
version = rubyVersion version = rubyVersion
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion } else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
+1
View File
@@ -28,6 +28,7 @@ versions = entries.select { |entry|
versions['head'] = 'https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z' 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['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' versions['mswin'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z'
versions['ucrt'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z'
js = "export const versions = #{JSON.pretty_generate(versions)}\n" js = "export const versions = #{JSON.pretty_generate(versions)}\n"
File.binwrite 'windows-versions.js', js File.binwrite 'windows-versions.js', js
+11 -4
View File
@@ -51,6 +51,13 @@ export async function setupRuby(options = {}) {
createGemRC(engine, version) createGemRC(engine, version)
envPreInstall() envPreInstall()
// JRuby can use compiled extension code, so make sure gcc exists.
// As of Jan-2022, JRuby compiles against msvcrt.
if (platform.startsWith('windows') && (engine === 'jruby') &&
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
await require('./windows').installJRubyTools()
}
const rubyPrefix = await installer.install(platform, engine, version) const rubyPrefix = await installer.install(platform, engine, version)
// When setup-ruby is used by other actions, this allows code in them to run // When setup-ruby is used by other actions, this allows code in them to run
@@ -64,11 +71,11 @@ export async function setupRuby(options = {}) {
const [gemfile, lockFile] = bundler.detectGemfiles() const [gemfile, lockFile] = bundler.detectGemfiles()
const bundlerVersion = await common.measure('Installing Bundler', async () => const bundlerVersion = await common.measure('Installing Bundler', async () =>
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version)) bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
if (inputs['bundler-cache'] === 'true') { if (inputs['bundler-cache'] === 'true') {
await common.measure('bundle install', async () => await common.measure('bundle install', async () =>
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version'])) bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
} }
} }
@@ -91,13 +98,13 @@ function parseRubyEngineAndVersion(rubyVersion) {
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 } else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim() const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
const rubyLine = toolVersions.split(/\r?\n/).filter(e => e.match(/^ruby\s/))[0] const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1] rubyVersion = rubyLine.match(/^ruby\s+(.+)$/)[1]
console.log(`Using ${rubyVersion} as input from file .tool-versions`) console.log(`Using ${rubyVersion} as input from file .tool-versions`)
} }
let engine, version let engine, version
if (rubyVersion.match(/^(\d+)/) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z if (/^(\d+)/.test(rubyVersion) || common.isHeadVersion(rubyVersion)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby' engine = 'ruby'
version = rubyVersion version = rubyVersion
} else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion } else if (!rubyVersion.includes('-')) { // myruby -> myruby-stableVersion
+2 -2
View File
@@ -22,13 +22,13 @@
}, },
"homepage": "https://github.com/ruby/setup-ruby", "homepage": "https://github.com/ruby/setup-ruby",
"dependencies": { "dependencies": {
"@actions/cache": "^1.0.7", "@actions/cache": "^1.0.8",
"@actions/core": "^1.4.0", "@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0", "@actions/exec": "^1.1.0",
"@actions/io": "^1.1.1", "@actions/io": "^1.1.1",
"@actions/tool-cache": "^1.7.1" "@actions/tool-cache": "^1.7.1"
}, },
"devDependencies": { "devDependencies": {
"@vercel/ncc": "^0.28.6" "@vercel/ncc": "^0.31.1"
} }
} }
+12 -6
View File
@@ -8,20 +8,26 @@ export function getVersions(platform) {
"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.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.4.10", "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.4.10",
"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.5.8", "2.5.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.5.8", "2.5.9",
"2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8", "2.6.0", "2.6.1", "2.6.2", "2.6.3", "2.6.4", "2.6.5", "2.6.6", "2.6.7", "2.6.8", "2.6.9",
"2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", "2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", "2.7.5",
"3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2", "3.0.0-preview1", "3.0.0-preview2", "3.0.0-rc1", "3.0.0", "3.0.1", "3.0.2", "3.0.3",
"head", "debug", "3.1.0-preview1", "3.1.0",
"head", "debug"
], ],
"jruby": [ "jruby": [
"9.1.17.0", "9.1.17.0",
"9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.9.0", "9.2.10.0", "9.2.11.0", "9.2.11.1", "9.2.12.0", "9.2.13.0", "9.2.14.0", "9.2.15.0", "9.2.16.0", "9.2.17.0", "9.2.18.0", "9.2.19.0", "9.2.20.0", "9.2.20.1",
"9.3.0.0", "9.3.1.0", "9.3.2.0",
"head" "head"
], ],
"truffleruby": [ "truffleruby": [
"19.3.0", "19.3.1", "19.3.0", "19.3.1",
"20.0.0", "20.1.0", "20.2.0", "20.3.0", "20.0.0", "20.1.0", "20.2.0", "20.3.0",
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.0.0", "21.1.0", "21.2.0", "21.2.0.1", "21.3.0",
"head"
],
"truffleruby+graalvm": [
"21.2.0", "21.3.0",
"head" "head"
] ]
} }
+27 -3
View File
@@ -35,19 +35,43 @@ export async function install(platform, engine, version) {
common.setupPath([path.join(rubyPrefix, 'bin')]) common.setupPath([path.join(rubyPrefix, 'bin')])
if (!inToolCache) { if (!inToolCache) {
await downloadAndExtract(platform, engine, version, rubyPrefix); await preparePrefix(rubyPrefix)
if (engine === 'truffleruby+graalvm') {
await installWithRubyBuild(engine, version, rubyPrefix)
} else {
await downloadAndExtract(platform, engine, version, rubyPrefix)
}
} }
return rubyPrefix return rubyPrefix
} }
async function downloadAndExtract(platform, engine, version, rubyPrefix) { async function preparePrefix(rubyPrefix) {
const parentDir = path.dirname(rubyPrefix) const parentDir = path.dirname(rubyPrefix)
await io.rmRF(rubyPrefix) await io.rmRF(rubyPrefix)
if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) { if (!(fs.existsSync(parentDir) && fs.statSync(parentDir).isDirectory())) {
await io.mkdirP(parentDir) await io.mkdirP(parentDir)
} }
}
async function installWithRubyBuild(engine, version, rubyPrefix) {
const tmp = process.env['RUNNER_TEMP'] || os.tmpdir()
const rubyBuildDir = path.join(tmp, 'ruby-build-for-setup-ruby')
await common.measure('Cloning ruby-build', async () => {
await exec.exec('git', ['clone', 'https://github.com/rbenv/ruby-build.git', rubyBuildDir])
})
const rubyName = `${engine}-${version === 'head' ? 'dev' : version}`
await common.measure(`Installing ${engine}-${version} with ruby-build`, async () => {
await exec.exec(`${rubyBuildDir}/bin/ruby-build`, [rubyName, rubyPrefix])
})
await io.rmRF(rubyBuildDir)
}
async function downloadAndExtract(platform, engine, version, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix)
const downloadPath = await common.measure('Downloading Ruby', async () => { const downloadPath = await common.measure('Downloading Ruby', async () => {
const url = getDownloadURL(platform, engine, version) const url = getDownloadURL(platform, engine, version)
@@ -55,7 +79,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
return await tc.downloadTool(url) return await tc.downloadTool(url)
}) })
await common.measure('Extracting Ruby', async () => { await common.measure('Extracting Ruby', async () => {
if (windows) { if (windows) {
// Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths // Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths
await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)]) await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)])
+6 -1
View File
@@ -31,15 +31,20 @@ export const versions = {
"2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-2/rubyinstaller-2.6.6-2-x64.7z", "2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-2/rubyinstaller-2.6.6-2-x64.7z",
"2.6.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.7-1/rubyinstaller-2.6.7-1-x64.7z", "2.6.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.7-1/rubyinstaller-2.6.7-1-x64.7z",
"2.6.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.8-1/rubyinstaller-2.6.8-1-x64.7z", "2.6.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.8-1/rubyinstaller-2.6.8-1-x64.7z",
"2.6.9": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.9-1/rubyinstaller-2.6.9-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",
"2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z", "2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z",
"2.7.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-2.7.2-1-x64.7z", "2.7.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-2.7.2-1-x64.7z",
"2.7.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.3-1/rubyinstaller-2.7.3-1-x64.7z", "2.7.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.3-1/rubyinstaller-2.7.3-1-x64.7z",
"2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z", "2.7.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.4-1/rubyinstaller-2.7.4-1-x64.7z",
"2.7.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.5-1/rubyinstaller-2.7.5-1-x64.7z",
"3.0.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.7z", "3.0.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.0-1/rubyinstaller-3.0.0-1-x64.7z",
"3.0.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.1-1/rubyinstaller-3.0.1-1-x64.7z", "3.0.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.1-1/rubyinstaller-3.0.1-1-x64.7z",
"3.0.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.2-1/rubyinstaller-3.0.2-1-x64.7z", "3.0.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.2-1/rubyinstaller-3.0.2-1-x64.7z",
"3.0.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.0.3-1/rubyinstaller-3.0.3-1-x64.7z",
"3.1.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z",
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-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", "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" "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z",
"ucrt": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z"
} }
+129 -15
View File
@@ -13,12 +13,16 @@ const rubyInstallerVersions = require('./windows-versions').versions
const drive = common.drive const drive = common.drive
const msys2BasePath = 'C:\\msys64'
// needed for 2.0-2.3, and mswin, cert file used by Git for Windows // needed for 2.0-2.3, and mswin, cert file used by Git for Windows
const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
// location & path for old RubyInstaller DevKit (MSYS), Ruby 2.0-2.3 // location & path for old RubyInstaller DevKit (MSYS1), Ruby 2.0-2.3
const msys = `${drive}:\\DevKit64` const msys1 = `${drive}:\\DevKit64`
const msysPathEntries = [`${msys}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys}\\mingw\\bin`, `${msys}\\bin`] const msysPathEntries = [`${msys1}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys1}\\mingw\\bin`, `${msys1}\\bin`]
const virtualEnv = common.getVirtualEnvironmentName()
export function getAvailableVersions(platform, engine) { export function getAvailableVersions(platform, engine) {
if (engine === 'ruby') { if (engine === 'ruby') {
@@ -31,6 +35,10 @@ export function getAvailableVersions(platform, engine) {
export async function install(platform, engine, version) { export async function install(platform, engine, version) {
const url = rubyInstallerVersions[version] const url = rubyInstallerVersions[version]
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
// and MinGW build tools installed. The windows-2022 image has neither.
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv)
if (!url.endsWith('.7z')) { if (!url.endsWith('.7z')) {
throw new Error(`URL should end in .7z: ${url}`) throw new Error(`URL should end in .7z: ${url}`)
} }
@@ -50,15 +58,71 @@ export async function install(platform, engine, version) {
let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version) let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version)
common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
if (!inToolCache) { if (!inToolCache) {
await downloadAndExtract(engine, version, url, base, rubyPrefix); await downloadAndExtract(engine, version, url, base, rubyPrefix);
} }
const msys2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths])
// install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
if (!hasMSYS2PreInstalled) {
await installMSYS2Tools()
}
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
// ucrt64 or mingw64 installed, depending on Ruby version
if (((msys2Type === 'ucrt64') || !hasMSYS2PreInstalled) && common.floatVersion(version) >= 2.4) {
await installGCCTools(msys2Type)
}
const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
if (fs.existsSync(ridk)) {
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
}
return rubyPrefix return rubyPrefix
} }
// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it,
// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled.
async function installGCCTools(type) {
const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => {
let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/${type}.7z`
console.log(url)
return await tc.downloadTool(url)
})
await common.measure(`Extracting ${type} build tools`, async () =>
// -aoa overwrite existing, -bd disable progress indicator
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
}
// Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it.
// A subset of the MSYS2 base-devel group
async function installMSYS2Tools() {
const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => {
let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z`
console.log(url)
return await tc.downloadTool(url)
})
// need to remove all directories, since they may indicate old packages are installed,
// otherwise, error of "error: duplicated database entry"
fs.rmdirSync(`${msys2BasePath}\\var\\lib\\pacman\\local`, { recursive: true, force: true })
await common.measure(`Extracting msys2 build tools`, async () =>
// -aoa overwrite existing, -bd disable progress indicator
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
}
// Windows JRuby can install gems that require compile tools, only needed for
// windows-2022 and later images
export async function installJRubyTools() {
await installMSYS2Tools()
await installGCCTools('mingw64')
}
async function downloadAndExtract(engine, version, url, base, rubyPrefix) { async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
const parentDir = path.dirname(rubyPrefix) const parentDir = path.dirname(rubyPrefix)
@@ -67,8 +131,9 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
return await tc.downloadTool(url) return await tc.downloadTool(url)
}) })
await common.measure('Extracting Ruby', async () => await common.measure('Extracting Ruby', async () =>
exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) // -bd disable progress indicator, -xr extract but exclude share\doc files
exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true }))
if (base !== path.basename(rubyPrefix)) { if (base !== path.basename(rubyPrefix)) {
await io.mv(path.join(parentDir, base), rubyPrefix) await io.mv(path.join(parentDir, base), rubyPrefix)
@@ -82,23 +147,29 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
async function setupMingw(version) { async function setupMingw(version) {
core.exportVariable('MAKE', 'make.exe') core.exportVariable('MAKE', 'make.exe')
// rename these to avoid confusion when Ruby is using OpenSSL 1.0.2.
// most current extconf files look for 1.1.x dll files first, which is the version of the renamed files
if (common.floatVersion(version) <= 2.4) {
renameSystem32Dlls()
}
if (common.floatVersion(version) <= 2.3) { if (common.floatVersion(version) <= 2.3) {
core.exportVariable('SSL_CERT_FILE', certFile) core.exportVariable('SSL_CERT_FILE', certFile)
await common.measure('Installing MSYS', async () => installMSYS(version)) await common.measure('Installing MSYS1', async () => installMSYS1(version))
return msysPathEntries return msysPathEntries
} else { } else {
return [] return []
} }
} }
// Ruby 2.0, 2.1, 2.2 and 2.3 // Ruby 2.0-2.3
async function installMSYS(version) { async function installMSYS1(version) {
const url = 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe' const url = 'https://github.com/oneclick/rubyinstaller/releases/download/devkit-4.7.2/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'
const downloadPath = await tc.downloadTool(url) const downloadPath = await tc.downloadTool(url)
await exec.exec('7z', ['x', downloadPath, `-o${msys}`], { silent: true }) await exec.exec('7z', ['x', downloadPath, `-o${msys1}`], { silent: true })
// below are set in the old devkit.rb file ? // below are set in the old devkit.rb file ?
core.exportVariable('RI_DEVKIT', msys) core.exportVariable('RI_DEVKIT', msys1)
core.exportVariable('CC' , 'gcc') core.exportVariable('CC' , 'gcc')
core.exportVariable('CXX', 'g++') core.exportVariable('CXX', 'g++')
core.exportVariable('CPP', 'cpp') core.exportVariable('CPP', 'cpp')
@@ -126,15 +197,28 @@ async function setupMSWin() {
/* Sets MSVC environment for use in Actions /* Sets MSVC environment for use in Actions
* allows steps to run without running vcvars*.bat, also for PowerShell * allows steps to run without running vcvars*.bat, also for PowerShell
* adds a convenience VCVARS environment variable * adds a convenience VCVARS environment variable
* this assumes a single Visual Studio version being available in the windows-latest image */ * this assumes a single Visual Studio version being available in the Windows images */
export function addVCVARSEnv() { export function addVCVARSEnv() {
const vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' let vcVars = ''
switch (virtualEnv) {
case 'windows-2016':
vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
case 'windows-2019':
vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
case 'windows-2022':
vcVars = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"'
break
default:
throw new Error(`Unknown Windows Image: ${virtualEnv}`)
}
core.exportVariable('VCVARS', vcVars) core.exportVariable('VCVARS', vcVars)
let newEnv = new Map() let newEnv = new Map()
let cmd = `cmd.exe /c "${vcVars} && set"` let cmd = `cmd.exe /c "${vcVars} && set"`
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/) let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
newSet = newSet.filter(line => line.match(/\S=\S/)) newSet = newSet.filter(line => /\S=\S/.test(line))
newSet.forEach(s => { newSet.forEach(s => {
let [k,v] = common.partition(s, '=') let [k,v] = common.partition(s, '=')
newEnv.set(k,v) newEnv.set(k,v)
@@ -153,3 +237,33 @@ export function addVCVARSEnv() {
} }
return newPathEntries return newPathEntries
} }
// ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from build folder due to dll resolution
function renameSystem32Dlls() {
const sys32 = 'C:\\Windows\\System32\\'
const badFiles = [`${sys32}libcrypto-1_1-x64.dll`, `${sys32}libssl-1_1-x64.dll`]
const existing = badFiles.filter((dll) => fs.existsSync(dll))
console.log(`Renaming ${existing.join(' and ')} to avoid dll resolution conflicts on Ruby <= 2.4`)
existing.forEach(dll => fs.renameSync(dll, `${dll}_`))
}
// Sets MSYS2 ENV variables set from running `ridk enable`
function addRidkEnv(ridk) {
let newEnv = new Map()
let cmd = `cmd.exe /c "${ridk} enable && set"`
let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/)
newSet = newSet.filter(line => /^\S+=\S+/.test(line))
newSet.forEach(s => {
let [k, v] = common.partition(s, '=')
newEnv.set(k, v)
})
for (let [k, v] of newEnv) {
if (process.env[k] !== v) {
if (!/^Path$/i.test(k)) {
console.log(`${k}=${v}`)
core.exportVariable(k, v)
}
}
}
}
Generated
+8 -8
View File
@@ -2,10 +2,10 @@
# yarn lockfile v1 # yarn lockfile v1
"@actions/cache@^1.0.7": "@actions/cache@^1.0.8":
version "1.0.7" version "1.0.8"
resolved "https://registry.yarnpkg.com/@actions/cache/-/cache-1.0.7.tgz#d80b0f5ac1e1ad48a5e77c39685100bd49b56b1c" resolved "https://registry.yarnpkg.com/@actions/cache/-/cache-1.0.8.tgz#426ad3a2127b35a4e21ad906e02202dc8b96663f"
integrity sha512-MY69kxuubqUFq84pFlu8m6Poxl5sR/xyhpC4JEvno7Yg9ASYdGizEmKgt0m8ovewpYKf15UAOcSC0hzS+DuosA== integrity sha512-GWNNB67w93HGJRQXlsV56YqrdAuDoP3esK/mo5mzU8WoDCVjtQgJGsTdkYUX7brswtT7xnI30bWNo1WLKQ8FZQ==
dependencies: dependencies:
"@actions/core" "^1.2.6" "@actions/core" "^1.2.6"
"@actions/exec" "^1.0.1" "@actions/exec" "^1.0.1"
@@ -195,10 +195,10 @@
dependencies: dependencies:
"@types/node" "*" "@types/node" "*"
"@vercel/ncc@^0.28.6": "@vercel/ncc@^0.31.1":
version "0.28.6" version "0.31.1"
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.28.6.tgz#073c0ce8e0269210c0a9f180fb0bf949eecc20e0" resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.31.1.tgz#9346c7e59326f5eeac75c0286e47df94c2d6d8f7"
integrity sha512-t4BoSSuyK8BZaUE0gV18V6bkFs4st7baumtFGa50dv1tMu2GDBEBF8sUZaKBdKiL6DzJ2D2+XVCwYWWDcQOYdQ== integrity sha512-g0FAxwdViI6UzsiVz5HssIHqjcPa1EHL6h+2dcJD893SoCJaGdqqgUF09xnMW6goWnnhbLvgiKlgJWrJa+7qYA==
abort-controller@^3.0.0: abort-controller@^3.0.0:
version "3.0.0" version "3.0.0"