mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93287a1fa8 | ||
|
|
3190662165 | ||
|
|
eb7f94ffae | ||
|
|
ad718faf7a |
@@ -18,7 +18,12 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12, windows-2019, windows-2022 ]
|
os: [ ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-10.15, macos-11, macos-12, 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', '3.1', '3.2', ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ]
|
ruby: [
|
||||||
|
'1.9', '2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', ruby-head,
|
||||||
|
jruby, jruby-head,
|
||||||
|
truffleruby, truffleruby-head,
|
||||||
|
truffleruby+graalvm, truffleruby+graalvm-head
|
||||||
|
]
|
||||||
include:
|
include:
|
||||||
- { os: windows-2019, ruby: mingw }
|
- { os: windows-2019, ruby: mingw }
|
||||||
- { os: windows-2019, ruby: mswin }
|
- { os: windows-2019, ruby: mswin }
|
||||||
@@ -239,6 +244,17 @@ jobs:
|
|||||||
bundler: 2.2.3
|
bundler: 2.2.3
|
||||||
- run: bundle --version | grep -F "Bundler version 2.2.3"
|
- run: bundle --version | grep -F "Bundler version 2.2.3"
|
||||||
|
|
||||||
|
testBundlerPre:
|
||||||
|
name: "Test with a Bundler pre/rc version"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ruby-version: '2.6'
|
||||||
|
bundler: 2.2.0.rc.2
|
||||||
|
- run: bundle --version | grep -F "Bundler version 2.2.0.rc.2"
|
||||||
|
|
||||||
testBundlerDev:
|
testBundlerDev:
|
||||||
name: "Test BUNDLED WITH Bundler dev"
|
name: "Test BUNDLED WITH Bundler dev"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
+7
-4
@@ -6,7 +6,10 @@ const cache = require('@actions/cache')
|
|||||||
const common = require('./common')
|
const common = require('./common')
|
||||||
|
|
||||||
export const DEFAULT_CACHE_VERSION = '0'
|
export const DEFAULT_CACHE_VERSION = '0'
|
||||||
export const BUNDLER_VERSION_REGEXP = /^\d+(?:\.\d+){0,2}$/
|
|
||||||
|
function isValidBundlerVersion(bundlerVersion) {
|
||||||
|
return /^\d+(?:\.\d+){0,2}/.test(bundlerVersion) && !bundlerVersion.endsWith('.dev')
|
||||||
|
}
|
||||||
|
|
||||||
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
||||||
export function detectGemfiles() {
|
export function detectGemfiles() {
|
||||||
@@ -33,7 +36,7 @@ function readBundledWithFromGemfileLock(lockFile) {
|
|||||||
const nextLine = lines[bundledWithLine+1]
|
const nextLine = lines[bundledWithLine+1]
|
||||||
if (nextLine) {
|
if (nextLine) {
|
||||||
const bundlerVersion = nextLine.trim()
|
const bundlerVersion = nextLine.trim()
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||||
return bundlerVersion
|
return bundlerVersion
|
||||||
} else {
|
} else {
|
||||||
@@ -100,7 +103,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
bundlerVersion = '2'
|
bundlerVersion = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
// OK - input is a 1, 2, or 3 part version number
|
// OK - input is a 1, 2, or 3 part version number
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
@@ -139,7 +142,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
||||||
|
|
||||||
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
||||||
const bundlerVersionConstraint = versionParts === 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
||||||
|
|
||||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||||
|
|
||||||
|
|||||||
+7
-5
@@ -8,7 +8,6 @@
|
|||||||
__nccwpck_require__.r(__webpack_exports__);
|
__nccwpck_require__.r(__webpack_exports__);
|
||||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||||
/* harmony export */ "DEFAULT_CACHE_VERSION": () => (/* binding */ DEFAULT_CACHE_VERSION),
|
/* harmony export */ "DEFAULT_CACHE_VERSION": () => (/* binding */ DEFAULT_CACHE_VERSION),
|
||||||
/* harmony export */ "BUNDLER_VERSION_REGEXP": () => (/* binding */ BUNDLER_VERSION_REGEXP),
|
|
||||||
/* harmony export */ "detectGemfiles": () => (/* binding */ detectGemfiles),
|
/* harmony export */ "detectGemfiles": () => (/* binding */ detectGemfiles),
|
||||||
/* harmony export */ "installBundler": () => (/* binding */ installBundler),
|
/* harmony export */ "installBundler": () => (/* binding */ installBundler),
|
||||||
/* harmony export */ "bundleInstall": () => (/* binding */ bundleInstall)
|
/* harmony export */ "bundleInstall": () => (/* binding */ bundleInstall)
|
||||||
@@ -21,7 +20,10 @@ const cache = __nccwpck_require__(7799)
|
|||||||
const common = __nccwpck_require__(4717)
|
const common = __nccwpck_require__(4717)
|
||||||
|
|
||||||
const DEFAULT_CACHE_VERSION = '0'
|
const DEFAULT_CACHE_VERSION = '0'
|
||||||
const BUNDLER_VERSION_REGEXP = /^\d+(?:\.\d+){0,2}$/
|
|
||||||
|
function isValidBundlerVersion(bundlerVersion) {
|
||||||
|
return /^\d+(?:\.\d+){0,2}/.test(bundlerVersion) && !bundlerVersion.endsWith('.dev')
|
||||||
|
}
|
||||||
|
|
||||||
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
// The returned gemfile is guaranteed to exist, the lockfile might not exist
|
||||||
function detectGemfiles() {
|
function detectGemfiles() {
|
||||||
@@ -48,7 +50,7 @@ function readBundledWithFromGemfileLock(lockFile) {
|
|||||||
const nextLine = lines[bundledWithLine+1]
|
const nextLine = lines[bundledWithLine+1]
|
||||||
if (nextLine) {
|
if (nextLine) {
|
||||||
const bundlerVersion = nextLine.trim()
|
const bundlerVersion = nextLine.trim()
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||||
return bundlerVersion
|
return bundlerVersion
|
||||||
} else {
|
} else {
|
||||||
@@ -115,7 +117,7 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
|||||||
bundlerVersion = '2'
|
bundlerVersion = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
if (isValidBundlerVersion(bundlerVersion)) {
|
||||||
// OK - input is a 1, 2, or 3 part version number
|
// OK - input is a 1, 2, or 3 part version number
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
@@ -154,7 +156,7 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
|||||||
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : []
|
||||||
|
|
||||||
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length
|
||||||
const bundlerVersionConstraint = versionParts === 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0`
|
||||||
|
|
||||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user