From a6f22865941e122a37e097fbded3dd0b54c39207 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Tue, 5 Oct 2021 16:57:38 +0200 Subject: [PATCH] Use the proper ABI version for caching gems of truffleruby-head * Previously the commit was used. --- bundler.js | 25 ++++++++++++++----------- dist/index.js | 25 ++++++++++++++----------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/bundler.js b/bundler.js index 7b03241..b5a8a49 100644 --- a/bundler.js +++ b/bundler.js @@ -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}` diff --git a/dist/index.js b/dist/index.js index b48bce9..95ec40b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -197,18 +197,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}`