mirror of https://github.com/actions/toolkit
Fix lint issues
parent
ea9856079f
commit
4fa5b7d133
|
@ -196,7 +196,7 @@ test('gzip create tar', async () => {
|
||||||
'manifest.txt',
|
'manifest.txt',
|
||||||
'-z',
|
'-z',
|
||||||
'-cf',
|
'-cf',
|
||||||
IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip,
|
IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip
|
||||||
]
|
]
|
||||||
.concat(IS_WINDOWS ? ['--force-local'] : [])
|
.concat(IS_WINDOWS ? ['--force-local'] : [])
|
||||||
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
|
.concat(IS_MAC ? ['--delay-directory-restore'] : []),
|
||||||
|
@ -281,4 +281,3 @@ test('gzip list tar', async () => {
|
||||||
{cwd: undefined}
|
{cwd: undefined}
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as io from '@actions/io'
|
||||||
import {existsSync, writeFileSync} from 'fs'
|
import {existsSync, writeFileSync} from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as utils from './cacheUtils'
|
import * as utils from './cacheUtils'
|
||||||
import {CompressionMethod, GnuTarPathOnWindows, SystemTarPathOnWindows} from './constants'
|
import {CompressionMethod, SystemTarPathOnWindows} from './constants'
|
||||||
|
|
||||||
const IS_WINDOWS = process.platform === 'win32'
|
const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
|
@ -54,7 +54,9 @@ function getWorkingDirectory(): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common function for extractTar and listTar to get the compression method
|
// Common function for extractTar and listTar to get the compression method
|
||||||
async function getCompressionProgram(compressionMethod: CompressionMethod): Promise<string[]> {
|
async function getCompressionProgram(
|
||||||
|
compressionMethod: CompressionMethod
|
||||||
|
): Promise<string[]> {
|
||||||
// -d: Decompress.
|
// -d: Decompress.
|
||||||
// unzstd is equivalent to 'zstd -d'
|
// unzstd is equivalent to 'zstd -d'
|
||||||
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
// --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit.
|
||||||
|
@ -68,7 +70,7 @@ async function getCompressionProgram(compressionMethod: CompressionMethod): Prom
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
'--use-compress-program',
|
'--use-compress-program',
|
||||||
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30',
|
IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30'
|
||||||
]
|
]
|
||||||
case CompressionMethod.ZstdWithoutLong:
|
case CompressionMethod.ZstdWithoutLong:
|
||||||
if (BSD_TAR_ZSTD) {
|
if (BSD_TAR_ZSTD) {
|
||||||
|
@ -136,9 +138,7 @@ export async function createTar(
|
||||||
switch (compressionMethod) {
|
switch (compressionMethod) {
|
||||||
case CompressionMethod.Zstd:
|
case CompressionMethod.Zstd:
|
||||||
if (BSD_TAR_ZSTD) {
|
if (BSD_TAR_ZSTD) {
|
||||||
return [
|
return ['-O', '|', 'zstd -T0 --long=30 -o']
|
||||||
'-O', '|', 'zstd -T0 --long=30 -o'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
'--use-compress-program',
|
'--use-compress-program',
|
||||||
|
@ -147,11 +147,13 @@ export async function createTar(
|
||||||
]
|
]
|
||||||
case CompressionMethod.ZstdWithoutLong:
|
case CompressionMethod.ZstdWithoutLong:
|
||||||
if (BSD_TAR_ZSTD) {
|
if (BSD_TAR_ZSTD) {
|
||||||
return [
|
return ['-O', '|', 'zstd -T0 -o']
|
||||||
'-O', '|', 'zstd -T0 -o'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt', '-cf']
|
return [
|
||||||
|
'--use-compress-program',
|
||||||
|
IS_WINDOWS ? 'zstd -T0' : 'zstdmt',
|
||||||
|
'-cf'
|
||||||
|
]
|
||||||
default:
|
default:
|
||||||
return ['-z', '-cf']
|
return ['-z', '-cf']
|
||||||
}
|
}
|
||||||
|
@ -166,8 +168,7 @@ export async function createTar(
|
||||||
'--files-from',
|
'--files-from',
|
||||||
manifestFilename,
|
manifestFilename,
|
||||||
...(await getCompressionProgram()),
|
...(await getCompressionProgram()),
|
||||||
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),
|
cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/')
|
||||||
|
|
||||||
]
|
]
|
||||||
await execTar(args, archiveFolder)
|
await execTar(args, archiveFolder)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue