Ignore Bundler dev version in Gemfile.lock
* Fixes https://github.com/ruby/setup-ruby/issues/394
This commit is contained in:
@@ -239,6 +239,18 @@ 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"
|
||||||
|
|
||||||
|
testBundlerDev:
|
||||||
|
name: "Test BUNDLED WITH Bundler dev"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/bundler-dev.gemfile
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
ruby-version: ruby-head
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
testDependencyOnBundler1:
|
testDependencyOnBundler1:
|
||||||
name: "Test gemfile depending on Bundler 1"
|
name: "Test gemfile depending on Bundler 1"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
+9
-4
@@ -6,6 +6,7 @@ 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}$/
|
||||||
|
|
||||||
// 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() {
|
||||||
@@ -30,10 +31,14 @@ function readBundledWithFromGemfileLock(lockFile) {
|
|||||||
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
||||||
if (bundledWithLine !== -1) {
|
if (bundledWithLine !== -1) {
|
||||||
const nextLine = lines[bundledWithLine+1]
|
const nextLine = lines[bundledWithLine+1]
|
||||||
if (nextLine && /^\d+/.test(nextLine.trim())) {
|
if (nextLine) {
|
||||||
const bundlerVersion = nextLine.trim()
|
const bundlerVersion = nextLine.trim()
|
||||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
||||||
return bundlerVersion
|
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||||
|
return bundlerVersion
|
||||||
|
} else {
|
||||||
|
console.log(`Could not parse BUNDLED WITH version as a valid Bundler release, ignoring it: ${bundlerVersion}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +100,7 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
bundlerVersion = '2'
|
bundlerVersion = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^\d+(?:\.\d+){0,2}$/.test(bundlerVersion)) {
|
if (BUNDLER_VERSION_REGEXP.test(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}`)
|
||||||
|
|||||||
+10
-4
@@ -8,6 +8,7 @@
|
|||||||
__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)
|
||||||
@@ -20,6 +21,7 @@ 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}$/
|
||||||
|
|
||||||
// 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() {
|
||||||
@@ -44,10 +46,14 @@ function readBundledWithFromGemfileLock(lockFile) {
|
|||||||
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
const bundledWithLine = lines.findIndex(line => /^BUNDLED WITH$/.test(line.trim()))
|
||||||
if (bundledWithLine !== -1) {
|
if (bundledWithLine !== -1) {
|
||||||
const nextLine = lines[bundledWithLine+1]
|
const nextLine = lines[bundledWithLine+1]
|
||||||
if (nextLine && /^\d+/.test(nextLine.trim())) {
|
if (nextLine) {
|
||||||
const bundlerVersion = nextLine.trim()
|
const bundlerVersion = nextLine.trim()
|
||||||
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
if (BUNDLER_VERSION_REGEXP.test(bundlerVersion)) {
|
||||||
return bundlerVersion
|
console.log(`Using Bundler ${bundlerVersion} from ${lockFile} BUNDLED WITH ${bundlerVersion}`)
|
||||||
|
return bundlerVersion
|
||||||
|
} else {
|
||||||
|
console.log(`Could not parse BUNDLED WITH version as a valid Bundler release, ignoring it: ${bundlerVersion}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +115,7 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
|||||||
bundlerVersion = '2'
|
bundlerVersion = '2'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^\d+(?:\.\d+){0,2}$/.test(bundlerVersion)) {
|
if (BUNDLER_VERSION_REGEXP.test(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}`)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem "path"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
path (2.0.1)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
path
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.0.dev
|
||||||
Reference in New Issue
Block a user