From 7da380d64e65d81ac4a408a734cf2af40571b7a8 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 19 Jan 2020 13:28:54 +0100 Subject: [PATCH] Add support for Ruby 2.3 on Windows --- .github/workflows/test.yml | 5 ++--- README.md | 2 +- dist/index.js | 11 +++++++++-- generate-ruby-installer-versions.rb | 2 +- ruby-installer-versions.js | 3 +++ windows.js | 8 ++++++-- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5b2d24e..64a859e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,8 +16,6 @@ jobs: # 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 ] exclude: - - os: windows-latest - ruby: 2.3 - os: windows-latest ruby: jruby - os: windows-latest @@ -30,9 +28,10 @@ jobs: ruby-version: ${{ matrix.ruby }} - run: ruby --version - run: ridk version - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-latest' && !startsWith(matrix.ruby, '2.3') - name: OpenSSL version run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION' + if: matrix.os == 'windows-latest' - name: OpenSSL test run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(1024) }' - name: C extension test diff --git a/README.md b/README.md index 300127a..57ed752 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti | macOS | `macos-latest` | | Windows | `windows-latest` | -Ruby 2.3, JRuby and TruffleRuby are not yet supported on `windows-latest`. +JRuby and TruffleRuby are not yet supported on `windows-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). diff --git a/dist/index.js b/dist/index.js index f1cf70d..cf4762f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5682,6 +5682,9 @@ function _evaluateVersions(versions, versionSpec) { __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "versions", function() { return versions; }); const versions = { + "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", "2.4.1": "https://github.com/oneclick/rubyinstaller2/releases/download/2.4.1-2/rubyinstaller-2.4.1-2-x64.7z", "2.4.2": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.2-2/rubyinstaller-2.4.2-2-x64.7z", "2.4.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.3-2/rubyinstaller-2.4.3-2-x64.7z", @@ -7794,10 +7797,14 @@ async function install(platform, ruby) { await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`) const rubyPrefix = `C:\\${base}` - const msys2 = await linkMSYS2() + const [hostedRuby, msys2] = await linkMSYS2() const newPath = setupPath(msys2, rubyPrefix) core.exportVariable('PATH', newPath) + if (version.startsWith('2.3')) { + core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`) + } + if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) { await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`) } @@ -7817,7 +7824,7 @@ async function linkMSYS2() { const hostedMSYS2 = `${latestHostedRuby}\\msys64` const msys2 = 'C:\\msys64' await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`) - return msys2 + return [latestHostedRuby, msys2] } function setupPath(msys2, rubyPrefix) { diff --git a/generate-ruby-installer-versions.rb b/generate-ruby-installer-versions.rb index c68c96f..2969d82 100644 --- a/generate-ruby-installer-versions.rb +++ b/generate-ruby-installer-versions.rb @@ -18,7 +18,7 @@ versions = entries.select { |entry| }.sort_by { |version, entry| version }.select { |version, entry| - version >= "2.4" + version >= "2.3" }.map { |version, entry| [version, entry[:href]] }.to_h diff --git a/ruby-installer-versions.js b/ruby-installer-versions.js index f629161..4228d3a 100644 --- a/ruby-installer-versions.js +++ b/ruby-installer-versions.js @@ -1,4 +1,7 @@ export const versions = { + "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", "2.4.1": "https://github.com/oneclick/rubyinstaller2/releases/download/2.4.1-2/rubyinstaller-2.4.1-2-x64.7z", "2.4.2": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.2-2/rubyinstaller-2.4.2-2-x64.7z", "2.4.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.4.3-2/rubyinstaller-2.4.3-2-x64.7z", diff --git a/windows.js b/windows.js index 3277e1c..2751b57 100644 --- a/windows.js +++ b/windows.js @@ -29,10 +29,14 @@ export async function install(platform, ruby) { await exec.exec(`7z x ${downloadPath} -xr!${base}\\share\\doc -oC:\\`) const rubyPrefix = `C:\\${base}` - const msys2 = await linkMSYS2() + const [hostedRuby, msys2] = await linkMSYS2() const newPath = setupPath(msys2, rubyPrefix) core.exportVariable('PATH', newPath) + if (version.startsWith('2.3')) { + core.exportVariable('SSL_CERT_FILE', `${hostedRuby}\\ssl\\cert.pem`) + } + if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) { await exec.exec(`${rubyPrefix}\\bin\\gem install bundler -v "~> 1" --no-document`) } @@ -52,7 +56,7 @@ async function linkMSYS2() { const hostedMSYS2 = `${latestHostedRuby}\\msys64` const msys2 = 'C:\\msys64' await exec.exec(`cmd /c mklink /D ${msys2} ${hostedMSYS2}`) - return msys2 + return [latestHostedRuby, msys2] } function setupPath(msys2, rubyPrefix) {