mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-05-05 01:39:53 +02:00
Use zstd instead of gzip
This commit is contained in:
parent
eb78578266
commit
7c7ab7c49e
5 changed files with 31 additions and 13 deletions
|
@ -2,7 +2,7 @@ import * as core from "@actions/core";
|
|||
import * as path from "path";
|
||||
|
||||
import * as cacheHttpClient from "../src/cacheHttpClient";
|
||||
import { Events, Inputs } from "../src/constants";
|
||||
import { CacheFilename, Events, Inputs } from "../src/constants";
|
||||
import { ArtifactCacheEntry } from "../src/contracts";
|
||||
import run from "../src/restore";
|
||||
import * as tar from "../src/tar";
|
||||
|
@ -227,7 +227,7 @@ test("restore with cache found", async () => {
|
|||
return Promise.resolve(tempPath);
|
||||
});
|
||||
|
||||
const archivePath = path.join(tempPath, "cache.tgz");
|
||||
const archivePath = path.join(tempPath, CacheFilename);
|
||||
const setCacheStateMock = jest.spyOn(actionUtils, "setCacheState");
|
||||
const downloadCacheMock = jest.spyOn(cacheHttpClient, "downloadCache");
|
||||
|
||||
|
@ -297,7 +297,7 @@ test("restore with a pull request event and cache found", async () => {
|
|||
return Promise.resolve(tempPath);
|
||||
});
|
||||
|
||||
const archivePath = path.join(tempPath, "cache.tgz");
|
||||
const archivePath = path.join(tempPath, CacheFilename);
|
||||
const setCacheStateMock = jest.spyOn(actionUtils, "setCacheState");
|
||||
const downloadCacheMock = jest.spyOn(cacheHttpClient, "downloadCache");
|
||||
|
||||
|
@ -364,7 +364,7 @@ test("restore with cache found for restore key", async () => {
|
|||
return Promise.resolve(tempPath);
|
||||
});
|
||||
|
||||
const archivePath = path.join(tempPath, "cache.tgz");
|
||||
const archivePath = path.join(tempPath, CacheFilename);
|
||||
const setCacheStateMock = jest.spyOn(actionUtils, "setCacheState");
|
||||
const downloadCacheMock = jest.spyOn(cacheHttpClient, "downloadCache");
|
||||
|
||||
|
|
|
@ -45,7 +45,15 @@ test("extract tar", async () => {
|
|||
expect(execMock).toHaveBeenCalledTimes(1);
|
||||
expect(execMock).toHaveBeenCalledWith(
|
||||
`"${tarPath}"`,
|
||||
["-xz", "-f", archivePath, "-P", "-C", workspace],
|
||||
[
|
||||
"--use-compress-program",
|
||||
"zstd --long=31 -d",
|
||||
"-xf",
|
||||
archivePath,
|
||||
"-P",
|
||||
"-C",
|
||||
workspace
|
||||
],
|
||||
{ cwd: undefined }
|
||||
);
|
||||
});
|
||||
|
@ -70,8 +78,9 @@ test("create tar", async () => {
|
|||
expect(execMock).toHaveBeenCalledWith(
|
||||
`"${tarPath}"`,
|
||||
[
|
||||
"-cz",
|
||||
"-f",
|
||||
"--use-compress-program",
|
||||
"zstd -T0 --long=31",
|
||||
"-cf",
|
||||
CacheFilename,
|
||||
"-C",
|
||||
workspace,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue