Use the proper ABI version for caching gems of truffleruby-head

* Previously the commit was used.
This commit is contained in:
Benoit Daloze
2021-10-05 16:57:38 +02:00
parent c84889b9b9
commit a6f2286594
2 changed files with 28 additions and 22 deletions
+14 -11
View File
@@ -183,18 +183,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
if (engine === 'ruby' && common.isHeadVersion(version)) { if (common.isHeadVersion(version)) {
// CRuby dev versions do not change the ABI version when the ABI changes, so append the commit to the ABI version if (engine !== 'jruby') {
let revision = ''; // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
silent: true, let abi = ''
listeners: { await exec.exec('ruby', ['-e', print_abi], {
stdout: (data) => { silent: true,
revision += data.toString(); listeners: {
stdout: (data) => {
abi += data.toString();
}
} }
} });
}); key += `-ABI-${abi}`
key += `-revision-${revision}` }
} }
key += `-${lockFile}` key += `-${lockFile}`
Generated Vendored
+14 -11
View File
@@ -197,18 +197,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}` const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}` let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
if (engine === 'ruby' && common.isHeadVersion(version)) { if (common.isHeadVersion(version)) {
// CRuby dev versions do not change the ABI version when the ABI changes, so append the commit to the ABI version if (engine !== 'jruby') {
let revision = ''; // CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], { let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
silent: true, let abi = ''
listeners: { await exec.exec('ruby', ['-e', print_abi], {
stdout: (data) => { silent: true,
revision += data.toString(); listeners: {
stdout: (data) => {
abi += data.toString();
}
} }
} });
}); key += `-ABI-${abi}`
key += `-revision-${revision}` }
} }
key += `-${lockFile}` key += `-${lockFile}`