Are cross-OS caches possible? #160618
Replies: 4 comments 4 replies
-
| @louis-bompart Cache version is unique for a combination of compression tool used for compression of cache (Gzip, Zstd, etc based on runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique cache entries. This also means that a cache created on  | 
Beta Was this translation helpful? Give feedback.
-
| This is the code responsible for deciding which compression to use: function getCompressionMethod() {
    return __awaiter(this, void 0, void 0, function* () {
        if (process.platform === 'win32' && !(yield isGnuTarInstalled())) {
            // Disable zstd due to bug https://github.com/actions/cache/issues/301
            return constants_1.CompressionMethod.Gzip;
        }
        const versionOutput = yield getVersion('zstd');
        const version = semver.clean(versionOutput);
        if (!versionOutput.toLowerCase().includes('zstd command line interface')) {
            // zstd is not installed
            return constants_1.CompressionMethod.Gzip;
        }
        else if (!version || semver.lt(version, 'v1.3.2')) {
            // zstd is installed but using a version earlier than v1.3.2
            // v1.3.2 is required to use the `--long` options in zstd
            return constants_1.CompressionMethod.ZstdWithoutLong;
        }
        else {
            return constants_1.CompressionMethod.Zstd;
        }
    });
}
function isGnuTarInstalled() {
    return __awaiter(this, void 0, void 0, function* () {
        const versionOutput = yield getVersion('tar');
        return versionOutput.toLowerCase().includes('gnu tar');
    });
}Therefore, if you can manage to use the same compression everywhere, it should work. | 
Beta Was this translation helpful? Give feedback.
-
| We are working on cross os caching. We have also released a release in  | 
Beta Was this translation helpful? Give feedback.
-
| 🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as  2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the  Thank you for helping bring this Discussion to a resolution! 💬 | 
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋
I'm trying to set up
action/cachesin a Node app project. Mainly, I'm trying to cache my build outputs and redistribute them in subsequent jobs in a single workflow.The build occurs on a
ubuntu-latestrunner, and the subsequent jobs occur onubuntu-latestandwindows-latest.I adapted the
pathparameter to use\instead of/onwindows-latest, and I'm using an OS-agnostickeyfor the cache (to be precise:verdaccio-${{ github.sha }}-${{ github.run_attempt }}.)I noticed that when trying to restore the cache from
windows-latest, it ends up in a no-hit, but not onubuntu-latest(despite both jobs running after the job that uploaded the cache)I also noticed that all examples that I could find use
${{runner-os}}in thekey.My question is then, is it possible to cache something from a
linux-latestrunner and restore it in awindows-latest?Beta Was this translation helpful? Give feedback.
All reactions