mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-21 16:23:56 +08:00
Use 30 as the long distance matching window to support both 32-bit and 64-bit OS
This commit is contained in:
parent
a5d9a3b1a6
commit
75cd46ec0c
5 changed files with 17 additions and 42 deletions
|
@ -12,7 +12,6 @@ jest.mock("@actions/exec");
|
|||
jest.mock("@actions/io");
|
||||
|
||||
const IS_WINDOWS = process.platform === "win32";
|
||||
const IS_64OS = process.platform != "win32" || process.arch === "x64";
|
||||
|
||||
function getTempDir(): string {
|
||||
return path.join(__dirname, "_temp", "tar");
|
||||
|
@ -47,13 +46,12 @@ test("zstd extract tar", async () => {
|
|||
const tarPath = IS_WINDOWS
|
||||
? `${process.env["windir"]}\\System32\\tar.exe`
|
||||
: "tar";
|
||||
const zstdOptions = IS_64OS ? "zstd -d --long=31" : "zstd -d --long=30";
|
||||
expect(execMock).toHaveBeenCalledTimes(1);
|
||||
expect(execMock).toHaveBeenCalledWith(
|
||||
`"${tarPath}"`,
|
||||
[
|
||||
"--use-compress-program",
|
||||
zstdOptions,
|
||||
"zstd -d --long=30",
|
||||
"-xf",
|
||||
IS_WINDOWS ? archivePath.replace(/\\/g, "/") : archivePath,
|
||||
"-P",
|
||||
|
@ -142,14 +140,13 @@ test("zstd create tar", async () => {
|
|||
const tarPath = IS_WINDOWS
|
||||
? `${process.env["windir"]}\\System32\\tar.exe`
|
||||
: "tar";
|
||||
const zstdOptions = IS_64OS ? "zstd -T0 --long=31" : "zstd -T0 --long=30";
|
||||
|
||||
expect(execMock).toHaveBeenCalledTimes(1);
|
||||
expect(execMock).toHaveBeenCalledWith(
|
||||
`"${tarPath}"`,
|
||||
[
|
||||
"--use-compress-program",
|
||||
zstdOptions,
|
||||
"zstd -T0 --long=30",
|
||||
"-cf",
|
||||
IS_WINDOWS
|
||||
? CacheFilename.Zstd.replace(/\\/g, "/")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue