Use zstd instead of gzip if available

Add zstd to cache versioning
This commit is contained in:
Aiqiao Yan 2020-04-22 16:36:34 -04:00
parent 9ceee97d99
commit 97f7baa910
14 changed files with 523 additions and 201 deletions

View file

@ -54,8 +54,12 @@ async function run(): Promise<void> {
}
}
const compressionMethod = await utils.getCompressionMethod();
try {
const cacheEntry = await cacheHttpClient.getCacheEntry(keys);
const cacheEntry = await cacheHttpClient.getCacheEntry(keys, {
compressionMethod: compressionMethod
});
if (!cacheEntry?.archiveLocation) {
core.info(`Cache not found for input keys: ${keys.join(", ")}`);
return;
@ -63,7 +67,7 @@ async function run(): Promise<void> {
const archivePath = path.join(
await utils.createTempDirectory(),
"cache.tgz"
utils.getCacheFileName(compressionMethod)
);
core.debug(`Archive Path: ${archivePath}`);
@ -84,7 +88,7 @@ async function run(): Promise<void> {
)} MB (${archiveFileSize} B)`
);
await extractTar(archivePath);
await extractTar(archivePath, compressionMethod);
} finally {
// Try to delete the archive to save space
try {