Skip to content

Commit

Permalink
Use the proper ABI version for caching gems of truffleruby-head
Browse files Browse the repository at this point in the history
* Previously the commit was used.
  • Loading branch information
eregon committed Oct 5, 2021
1 parent c84889b commit a6f2286
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
25 changes: 14 additions & 11 deletions bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,21 @@ async function computeBaseKey(platform, engine, version, lockFile, cacheVersion)
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`

if (engine === 'ruby' && common.isHeadVersion(version)) {
// CRuby dev versions do not change the ABI version when the ABI changes, so append the commit to the ABI version
let revision = '';
await exec.exec('ruby', ['-e', 'print RUBY_REVISION'], {
silent: true,
listeners: {
stdout: (data) => {
revision += data.toString();
if (common.isHeadVersion(version)) {
if (engine !== 'jruby') {
// CRuby dev versions do not change the ABI version when the ABI changes, so use the commit as the ABI version
let print_abi = engine === 'ruby' ? 'print RUBY_REVISION' : "print RbConfig::CONFIG['ruby_version']"
let abi = ''
await exec.exec('ruby', ['-e', print_abi], {
silent: true,
listeners: {
stdout: (data) => {
abi += data.toString();
}
}
}
});
key += `-revision-${revision}`
});
key += `-ABI-${abi}`
}
}

key += `-${lockFile}`
Expand Down
25 changes: 14 additions & 11 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a6f2286

Please sign in to comment.