Automatically install libxml2-dev libxslt-dev on TruffleRuby if needed

* This is a special case, because TruffleRuby needs an extra system
  dependency that other Rubies do not, and GitHub runners do not have
  these packages installed by default, while TravisCI has them.
This commit is contained in:
Benoit Daloze
2021-01-09 14:48:58 +01:00
parent 3460195737
commit 5aaa89ff0d
5 changed files with 74 additions and 4 deletions
Generated Vendored
+29 -2
View File
@@ -32811,8 +32811,10 @@ function partition(string, separator) {
return [string.slice(0, i), string.slice(i + separator.length, string.length)]
}
let inGroup = false
async function measure(name, block) {
return await core.group(name, async () => {
const body = async () => {
const start = performance.now()
try {
return await block()
@@ -32821,7 +32823,20 @@ async function measure(name, block) {
const duration = (end - start) / 1000.0
console.log(`Took ${duration.toFixed(2).padStart(6)} seconds`)
}
})
}
if (inGroup) {
// Nested groups are not yet supported on GitHub Actions
console.log(`> ${name}`)
return await body()
} else {
inGroup = true
try {
return await core.group(name, body)
} finally {
inGroup = false
}
}
}
function isHeadVersion(rubyVersion) {
@@ -44559,6 +44574,16 @@ function readBundledWithFromGemfileLock(lockFile) {
return null
}
async function afterLockFile(lockFile, platform, engine) {
if (engine === 'truffleruby' && platform.startsWith('ubuntu-')) {
const contents = fs.readFileSync(lockFile, 'utf8')
if (contents.includes('nokogiri')) {
await common.measure('Installing libxml2-dev libxslt-dev, required to install nokogiri on TruffleRuby', async () =>
exec.exec('sudo', ['apt-get', '-yqq', 'install', 'libxml2-dev', 'libxslt-dev'], { silent: true }))
}
}
}
async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefix, engine, rubyVersion) {
let bundlerVersion = bundlerVersionInput
@@ -44633,6 +44658,8 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
await exec.exec('bundle', ['lock'], envOptions)
}
await afterLockFile(lockFile, platform, engine)
// cache key
const paths = [cachePath]
const baseKey = await computeBaseKey(platform, engine, rubyVersion, lockFile)