mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9a8687ae9 | ||
|
|
ae9cb3b565 | ||
|
|
77d7ca9909 | ||
|
|
e08bf35edf | ||
|
|
0997e21bf3 |
@@ -16,15 +16,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ]
|
||||
ruby: [ '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', ruby-head, jruby, jruby-head, truffleruby, truffleruby-head ]
|
||||
include:
|
||||
- { os: windows-2016, ruby: mingw }
|
||||
- { os: windows-2019, ruby: mingw }
|
||||
- { os: windows-2019, ruby: mswin }
|
||||
exclude:
|
||||
- { os: windows-2016, ruby: 1.9 }
|
||||
- { os: windows-2016, ruby: debug }
|
||||
- { os: windows-2016, ruby: truffleruby }
|
||||
- { os: windows-2016, ruby: truffleruby-head }
|
||||
- { os: windows-2019, ruby: 1.9 }
|
||||
- { os: windows-2019, ruby: debug }
|
||||
- { os: windows-2019, ruby: truffleruby }
|
||||
- { os: windows-2019, ruby: truffleruby-head }
|
||||
@@ -67,18 +69,22 @@ jobs:
|
||||
|
||||
- name: Subprocess test
|
||||
run: ruby test_subprocess.rb
|
||||
- name: OpenSSL version
|
||||
- name: OpenSSL compiled version
|
||||
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
|
||||
- name: OpenSSL loaded version
|
||||
run: ruby -ropenssl -e 'puts OpenSSL::OPENSSL_LIBRARY_VERSION'
|
||||
if: matrix.ruby != '1.9'
|
||||
- name: OpenSSL test
|
||||
run: ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }'
|
||||
|
||||
- run: gem env
|
||||
- name: C extension test
|
||||
run: gem install json:2.2.0 --no-document
|
||||
run: gem install json -v 2.2.0
|
||||
- run: bundle --version
|
||||
# This step is redundant with `bundler-cache: true` but is there to check a redundant `bundle install` still works
|
||||
- run: bundle install
|
||||
- run: bundle exec rake --version
|
||||
- run: bundle exec rake
|
||||
|
||||
- name: which ruby, rake
|
||||
if: "!startsWith(matrix.os, 'windows')"
|
||||
|
||||
@@ -14,9 +14,9 @@ This action currently supports these versions of MRI, JRuby and TruffleRuby:
|
||||
|
||||
| Interpreter | Versions |
|
||||
| ----------- | -------- |
|
||||
| `ruby` | 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.0.2, head, debug, mingw, mswin |
|
||||
| `jruby` | 9.1.17.0, 9.2.9.0 - 9.2.19.0, head |
|
||||
| `truffleruby` | 19.3.0 - 21.2.0, head |
|
||||
| `truffleruby` | 19.3.0 - 21.2.0.1, head |
|
||||
|
||||
`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.
|
||||
@@ -205,6 +205,7 @@ So, please use `bundler-cache: true` instead and report any issue.
|
||||
Note that running CI on Windows can be quite challenging if you are not very familiar with Windows.
|
||||
It is recommended to first get your build working on Ubuntu and macOS before trying Windows.
|
||||
|
||||
* Use Bundler 2.2.18+ on Windows (older versions have [bugs](https://github.com/ruby/setup-ruby/issues/209#issuecomment-889064123)) by not setting the `bundler:` input and ensuring there is no `BUNDLED WITH 1.x.y` in a checked-in `Gemfile.lock`.
|
||||
* The default shell on Windows is not Bash but [PowerShell](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell).
|
||||
This can lead issues such as multi-line scripts [not working as expected](https://github.com/ruby/setup-ruby/issues/13).
|
||||
* The `PATH` contains [multiple compiler toolchains](https://github.com/ruby/setup-ruby/issues/19). Use `where.exe` to debug which tool is used.
|
||||
|
||||
+4
-4
@@ -71,7 +71,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
|
||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) {
|
||||
@@ -86,12 +86,12 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
||||
// 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.
|
||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) {
|
||||
console.log(`Using Bundler 1 shipped with ${engine}`)
|
||||
} else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
|
||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||
} else {
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint, '--no-document'])
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
||||
}
|
||||
|
||||
return bundlerVersion
|
||||
|
||||
@@ -55,13 +55,17 @@ export function isStableVersion(rubyVersion) {
|
||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||
}
|
||||
|
||||
export function isBundler1Default(engine, rubyVersion) {
|
||||
return !isBundler2Default(engine, rubyVersion)
|
||||
}
|
||||
|
||||
export function isBundler2Default(engine, rubyVersion) {
|
||||
if (engine === 'ruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7
|
||||
return floatVersion(rubyVersion) >= 2.7
|
||||
} else if (engine === 'truffleruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 21.0
|
||||
return floatVersion(rubyVersion) >= 21.0
|
||||
} else if (engine === 'jruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 9.3
|
||||
return floatVersion(rubyVersion) >= 9.3
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@@ -71,8 +75,10 @@ export function floatVersion(rubyVersion) {
|
||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||
if (match) {
|
||||
return parseFloat(match[0])
|
||||
} else if (isHeadVersion(rubyVersion)) {
|
||||
return 999.999
|
||||
} else {
|
||||
return 0.0
|
||||
throw new Error(`Could not convert version ${rubyVersion} to a float`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+25
-13
@@ -85,7 +85,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby' && rubyVersion.match(/^2\.[012]/)) {
|
||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && rubyVersion.match(/^2\.3\.[01]/)) {
|
||||
@@ -100,12 +100,12 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
||||
// 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.
|
||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) {
|
||||
console.log(`Using Bundler 1 shipped with ${engine}`)
|
||||
} else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
|
||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||
} else {
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint, '--no-document'])
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint])
|
||||
}
|
||||
|
||||
return bundlerVersion
|
||||
@@ -229,6 +229,7 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ "measure": () => (/* binding */ measure),
|
||||
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
||||
/* harmony export */ "hashFile": () => (/* binding */ hashFile),
|
||||
@@ -296,13 +297,17 @@ function isStableVersion(rubyVersion) {
|
||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||
}
|
||||
|
||||
function isBundler1Default(engine, rubyVersion) {
|
||||
return !isBundler2Default(engine, rubyVersion)
|
||||
}
|
||||
|
||||
function isBundler2Default(engine, rubyVersion) {
|
||||
if (engine === 'ruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7
|
||||
return floatVersion(rubyVersion) >= 2.7
|
||||
} else if (engine === 'truffleruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 21.0
|
||||
return floatVersion(rubyVersion) >= 21.0
|
||||
} else if (engine === 'jruby') {
|
||||
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 9.3
|
||||
return floatVersion(rubyVersion) >= 9.3
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
@@ -312,8 +317,10 @@ function floatVersion(rubyVersion) {
|
||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||
if (match) {
|
||||
return parseFloat(match[0])
|
||||
} else if (isHeadVersion(rubyVersion)) {
|
||||
return 999.999
|
||||
} else {
|
||||
return 0.0
|
||||
throw new Error(`Could not convert version ${rubyVersion} to a float`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58756,6 +58763,7 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
function getVersions(platform) {
|
||||
const versions = {
|
||||
"ruby": [
|
||||
"1.9.3-p551",
|
||||
"2.0.0-p648",
|
||||
"2.1.9",
|
||||
"2.2.10",
|
||||
@@ -58775,7 +58783,7 @@ function getVersions(platform) {
|
||||
"truffleruby": [
|
||||
"19.3.0", "19.3.1",
|
||||
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
||||
"21.0.0", "21.1.0", "21.2.0",
|
||||
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1",
|
||||
"head"
|
||||
]
|
||||
}
|
||||
@@ -59038,7 +59046,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
async function setupMingw(version) {
|
||||
core.exportVariable('MAKE', 'make.exe')
|
||||
|
||||
if (version.match(/^2\.[0123]/)) {
|
||||
if (common.floatVersion(version) <= 2.3) {
|
||||
core.exportVariable('SSL_CERT_FILE', certFile)
|
||||
await common.measure('Installing MSYS', async () => installMSYS(version))
|
||||
return msysPathEntries
|
||||
@@ -59420,7 +59428,7 @@ async function setupRuby(options = {}) {
|
||||
const engineVersions = installer.getAvailableVersions(platform, engine)
|
||||
const version = validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVersion)
|
||||
|
||||
createGemRC()
|
||||
createGemRC(engine, version)
|
||||
envPreInstall()
|
||||
|
||||
const rubyPrefix = await installer.install(platform, engine, version)
|
||||
@@ -59510,10 +59518,14 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe
|
||||
return version
|
||||
}
|
||||
|
||||
function createGemRC() {
|
||||
function createGemRC(engine, version) {
|
||||
const gemrc = path.join(os.homedir(), '.gemrc')
|
||||
if (!fs.existsSync(gemrc)) {
|
||||
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||
if (engine === 'ruby' && common.floatVersion(version) < 2.0) {
|
||||
fs.writeFileSync(gemrc, `install: --no-rdoc --no-ri${os.EOL}update: --no-rdoc --no-ri${os.EOL}`)
|
||||
} else {
|
||||
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function setupRuby(options = {}) {
|
||||
const engineVersions = installer.getAvailableVersions(platform, engine)
|
||||
const version = validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVersion)
|
||||
|
||||
createGemRC()
|
||||
createGemRC(engine, version)
|
||||
envPreInstall()
|
||||
|
||||
const rubyPrefix = await installer.install(platform, engine, version)
|
||||
@@ -138,10 +138,14 @@ function validateRubyEngineAndVersion(platform, engineVersions, engine, parsedVe
|
||||
return version
|
||||
}
|
||||
|
||||
function createGemRC() {
|
||||
function createGemRC(engine, version) {
|
||||
const gemrc = path.join(os.homedir(), '.gemrc')
|
||||
if (!fs.existsSync(gemrc)) {
|
||||
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||
if (engine === 'ruby' && common.floatVersion(version) < 2.0) {
|
||||
fs.writeFileSync(gemrc, `install: --no-rdoc --no-ri${os.EOL}update: --no-rdoc --no-ri${os.EOL}`)
|
||||
} else {
|
||||
fs.writeFileSync(gemrc, `gem: --no-document${os.EOL}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
export function getVersions(platform) {
|
||||
const versions = {
|
||||
"ruby": [
|
||||
"1.9.3-p551",
|
||||
"2.0.0-p648",
|
||||
"2.1.9",
|
||||
"2.2.10",
|
||||
@@ -20,7 +21,7 @@ export function getVersions(platform) {
|
||||
"truffleruby": [
|
||||
"19.3.0", "19.3.1",
|
||||
"20.0.0", "20.1.0", "20.2.0", "20.3.0",
|
||||
"21.0.0", "21.1.0", "21.2.0",
|
||||
"21.0.0", "21.1.0", "21.2.0", "21.2.0.1",
|
||||
"head"
|
||||
]
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
async function setupMingw(version) {
|
||||
core.exportVariable('MAKE', 'make.exe')
|
||||
|
||||
if (version.match(/^2\.[0123]/)) {
|
||||
if (common.floatVersion(version) <= 2.3) {
|
||||
core.exportVariable('SSL_CERT_FILE', certFile)
|
||||
await common.measure('Installing MSYS', async () => installMSYS(version))
|
||||
return msysPathEntries
|
||||
|
||||
Reference in New Issue
Block a user