fix: extract zip files using 7z on windows

`extractZip` from @actions uses the pre-installed PowerShell
This doesn't work properly with old PowerShell versions
This commit is contained in:
Amin Yahyaabadi 2022-05-09 16:26:08 -07:00
parent ba5279b00d
commit cd21dd244f
7 changed files with 42 additions and 31 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
lockfileVersion: 5.3 lockfileVersion: 5.4
overrides: overrides:
semver: 7.3.7 semver: 7.3.7
@ -85,7 +85,7 @@ devDependencies:
prettier-config-atomic: 3.0.9 prettier-config-atomic: 3.0.9
shx: 0.3.4 shx: 0.3.4
terser-config-atomic: 0.1.1 terser-config-atomic: 0.1.1
ts-jest: 28.0.1_4db907953e67367985ae85b48dfb7df7 ts-jest: 28.0.1_jw4qpfj6m43htbnoqw2i363564
typescript: 4.6.4 typescript: 4.6.4
packages: packages:
@ -309,7 +309,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@babel/eslint-parser/7.17.0_7449dd49ffed0eea046851524f1e657b: /@babel/eslint-parser/7.17.0_ore52sp75uhoubdikfje6htfpm:
resolution: {integrity: sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==} resolution: {integrity: sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==}
engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0}
peerDependencies: peerDependencies:
@ -2212,7 +2212,7 @@ packages:
'@types/yargs-parser': 21.0.0 '@types/yargs-parser': 21.0.0
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.22.0_5b52bb1e77494a9627aef8db6adb10bc: /@typescript-eslint/eslint-plugin/5.22.0_lnjlwhtxjffjmj5o7dnwvwyqxq:
resolution: {integrity: sha512-YCiy5PUzpAeOPGQ7VSGDEY2NeYUV1B0swde2e0HzokRsHBYjSdF6DZ51OuRZxVPHx0032lXGLvOMls91D8FXlg==} resolution: {integrity: sha512-YCiy5PUzpAeOPGQ7VSGDEY2NeYUV1B0swde2e0HzokRsHBYjSdF6DZ51OuRZxVPHx0032lXGLvOMls91D8FXlg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2223,10 +2223,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.22.0_eslint@8.14.0+typescript@4.6.4 '@typescript-eslint/parser': 5.22.0_t725usgvqspm5woeqpaxbfp2qu
'@typescript-eslint/scope-manager': 5.22.0 '@typescript-eslint/scope-manager': 5.22.0
'@typescript-eslint/type-utils': 5.22.0_eslint@8.14.0+typescript@4.6.4 '@typescript-eslint/type-utils': 5.22.0_t725usgvqspm5woeqpaxbfp2qu
'@typescript-eslint/utils': 5.22.0_eslint@8.14.0+typescript@4.6.4 '@typescript-eslint/utils': 5.22.0_t725usgvqspm5woeqpaxbfp2qu
debug: 4.3.4 debug: 4.3.4
eslint: 8.14.0 eslint: 8.14.0
functional-red-black-tree: 1.0.1 functional-red-black-tree: 1.0.1
@ -2239,7 +2239,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.22.0_eslint@8.14.0+typescript@4.6.4: /@typescript-eslint/parser/5.22.0_t725usgvqspm5woeqpaxbfp2qu:
resolution: {integrity: sha512-piwC4krUpRDqPaPbFaycN70KCP87+PC5WZmrWs+DlVOxxmF+zI6b6hETv7Quy4s9wbkV16ikMeZgXsvzwI3icQ==} resolution: {integrity: sha512-piwC4krUpRDqPaPbFaycN70KCP87+PC5WZmrWs+DlVOxxmF+zI6b6hETv7Quy4s9wbkV16ikMeZgXsvzwI3icQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2267,7 +2267,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.22.0 '@typescript-eslint/visitor-keys': 5.22.0
dev: true dev: true
/@typescript-eslint/type-utils/5.22.0_eslint@8.14.0+typescript@4.6.4: /@typescript-eslint/type-utils/5.22.0_t725usgvqspm5woeqpaxbfp2qu:
resolution: {integrity: sha512-iqfLZIsZhK2OEJ4cQ01xOq3NaCuG5FQRKyHicA3xhZxMgaxQazLUHbH/B2k9y5i7l3+o+B5ND9Mf1AWETeMISA==} resolution: {integrity: sha512-iqfLZIsZhK2OEJ4cQ01xOq3NaCuG5FQRKyHicA3xhZxMgaxQazLUHbH/B2k9y5i7l3+o+B5ND9Mf1AWETeMISA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -2277,7 +2277,7 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/utils': 5.22.0_eslint@8.14.0+typescript@4.6.4 '@typescript-eslint/utils': 5.22.0_t725usgvqspm5woeqpaxbfp2qu
debug: 4.3.4 debug: 4.3.4
eslint: 8.14.0 eslint: 8.14.0
tsutils: 3.21.0_typescript@4.6.4 tsutils: 3.21.0_typescript@4.6.4
@ -2312,7 +2312,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.22.0_eslint@8.14.0+typescript@4.6.4: /@typescript-eslint/utils/5.22.0_t725usgvqspm5woeqpaxbfp2qu:
resolution: {integrity: sha512-HodsGb037iobrWSUMS7QH6Hl1kppikjA1ELiJlNSTYf/UdMEwzgj0WIp+lBNb6WZ3zTwb0tEz51j0Wee3iJ3wQ==} resolution: {integrity: sha512-HodsGb037iobrWSUMS7QH6Hl1kppikjA1ELiJlNSTYf/UdMEwzgj0WIp+lBNb6WZ3zTwb0tEz51j0Wee3iJ3wQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -3603,7 +3603,7 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/eslint-config-airbnb-base/14.2.1_662e1b2e8ef3f6aa5d22c3f7cd670612: /eslint-config-airbnb-base/14.2.1_myxbwluo6p3kuxjcyp342zygci:
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==} resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
@ -3618,7 +3618,7 @@ packages:
dev: true dev: true
optional: true optional: true
/eslint-config-airbnb/18.2.1_f59bbcee69361c545d044fb4451710cb: /eslint-config-airbnb/18.2.1_6wn3z3tjgyofixiej62ekfyqzm:
resolution: {integrity: sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==} resolution: {integrity: sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
@ -3629,7 +3629,7 @@ packages:
eslint-plugin-react-hooks: ^4 || ^3 || ^2.3.0 || ^1.7.0 eslint-plugin-react-hooks: ^4 || ^3 || ^2.3.0 || ^1.7.0
dependencies: dependencies:
eslint: 8.14.0 eslint: 8.14.0
eslint-config-airbnb-base: 14.2.1_662e1b2e8ef3f6aa5d22c3f7cd670612 eslint-config-airbnb-base: 14.2.1_myxbwluo6p3kuxjcyp342zygci
eslint-plugin-import: 2.26.0_eslint@8.14.0 eslint-plugin-import: 2.26.0_eslint@8.14.0
eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0 eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0
eslint-plugin-react: 7.23.2_eslint@8.14.0 eslint-plugin-react: 7.23.2_eslint@8.14.0
@ -3643,11 +3643,11 @@ packages:
resolution: {integrity: sha512-LFytMqabif4bB59bV8s3pc1gN/UNzRY53l5F8mzZQLKmSETXQ2UDTEJ62l8xyQocMsDcaCaY5ALNmJqBngIAFQ==} resolution: {integrity: sha512-LFytMqabif4bB59bV8s3pc1gN/UNzRY53l5F8mzZQLKmSETXQ2UDTEJ62l8xyQocMsDcaCaY5ALNmJqBngIAFQ==}
dependencies: dependencies:
'@babel/core': 7.17.10 '@babel/core': 7.17.10
'@babel/eslint-parser': 7.17.0_7449dd49ffed0eea046851524f1e657b '@babel/eslint-parser': 7.17.0_ore52sp75uhoubdikfje6htfpm
'@babel/plugin-syntax-flow': 7.16.7_@babel+core@7.17.10 '@babel/plugin-syntax-flow': 7.16.7_@babel+core@7.17.10
'@babel/plugin-syntax-jsx': 7.16.7_@babel+core@7.17.10 '@babel/plugin-syntax-jsx': 7.16.7_@babel+core@7.17.10
'@typescript-eslint/eslint-plugin': 5.22.0_5b52bb1e77494a9627aef8db6adb10bc '@typescript-eslint/eslint-plugin': 5.22.0_lnjlwhtxjffjmj5o7dnwvwyqxq
'@typescript-eslint/parser': 5.22.0_eslint@8.14.0+typescript@4.6.4 '@typescript-eslint/parser': 5.22.0_t725usgvqspm5woeqpaxbfp2qu
eslint: 8.14.0 eslint: 8.14.0
eslint-config-prettier: 8.5.0_eslint@8.14.0 eslint-config-prettier: 8.5.0_eslint@8.14.0
eslint-plugin-html: 6.2.0 eslint-plugin-html: 6.2.0
@ -3663,7 +3663,7 @@ packages:
typescript: 4.6.4 typescript: 4.6.4
optionalDependencies: optionalDependencies:
coffeescript: 1.12.7 coffeescript: 1.12.7
eslint-plugin-coffee: 0.1.15_c6af0447cbddeabec3406108d97c6f86 eslint-plugin-coffee: 0.1.15_y2xqir6l3xvl5q2ameens7dpqy
eslint-plugin-react-hooks: 4.5.0_eslint@8.14.0 eslint-plugin-react-hooks: 4.5.0_eslint@8.14.0
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -3693,20 +3693,20 @@ packages:
find-up: 2.1.0 find-up: 2.1.0
dev: true dev: true
/eslint-plugin-coffee/0.1.15_c6af0447cbddeabec3406108d97c6f86: /eslint-plugin-coffee/0.1.15_y2xqir6l3xvl5q2ameens7dpqy:
resolution: {integrity: sha512-+qtkIPSc9etYqOODIlENqiRjID/oEoGMAAQJN988Aczy461NIwzaamFY6Fi0QDVVDb2v+OL/StVrk/QmyItfeg==} resolution: {integrity: sha512-+qtkIPSc9etYqOODIlENqiRjID/oEoGMAAQJN988Aczy461NIwzaamFY6Fi0QDVVDb2v+OL/StVrk/QmyItfeg==}
requiresBuild: true requiresBuild: true
peerDependencies: peerDependencies:
eslint: '*' eslint: '*'
dependencies: dependencies:
axe-core: 3.5.6 axe-core: 3.5.6
babel-eslint: /@babel/eslint-parser/7.17.0_7449dd49ffed0eea046851524f1e657b babel-eslint: /@babel/eslint-parser/7.17.0_ore52sp75uhoubdikfje6htfpm
babylon: 7.0.0-beta.47 babylon: 7.0.0-beta.47
coffeescript: 2.7.0 coffeescript: 2.7.0
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.14.0 eslint: 8.14.0
eslint-config-airbnb: 18.2.1_f59bbcee69361c545d044fb4451710cb eslint-config-airbnb: 18.2.1_6wn3z3tjgyofixiej62ekfyqzm
eslint-config-airbnb-base: 14.2.1_662e1b2e8ef3f6aa5d22c3f7cd670612 eslint-config-airbnb-base: 14.2.1_myxbwluo6p3kuxjcyp342zygci
eslint-plugin-import: 2.26.0_eslint@8.14.0 eslint-plugin-import: 2.26.0_eslint@8.14.0
eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0 eslint-plugin-jsx-a11y: 6.5.1_eslint@8.14.0
eslint-plugin-react: 7.23.2_eslint@8.14.0 eslint-plugin-react: 7.23.2_eslint@8.14.0
@ -7618,7 +7618,7 @@ packages:
punycode: 2.1.1 punycode: 2.1.1
dev: true dev: true
/ts-jest/28.0.1_4db907953e67367985ae85b48dfb7df7: /ts-jest/28.0.1_jw4qpfj6m43htbnoqw2i363564:
resolution: {integrity: sha512-PbkbitaT/9ZYAqqzk3UYTvCq080Seo46T3m/AdwcZ0D8WH2uBhG6PvA8oOAWsZIknzPQU66fYobvFCL8IqIhmg==} resolution: {integrity: sha512-PbkbitaT/9ZYAqqzk3UYTvCq080Seo46T3m/AdwcZ0D8WH2uBhG6PvA8oOAWsZIknzPQU66fYobvFCL8IqIhmg==}
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
hasBin: true hasBin: true

View File

@ -1,8 +1,9 @@
import { extractZip, extractTar } from "@actions/tool-cache" import { extractTar } from "@actions/tool-cache"
import semverLte from "semver/functions/lte" import semverLte from "semver/functions/lte"
import semverCoerce from "semver/functions/coerce" import semverCoerce from "semver/functions/coerce"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin" import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { extractZip } from "../utils/setup/extract"
/** Get the platform data for cmake */ /** Get the platform data for cmake */
function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo { function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: string): PackageInfo {

View File

@ -1,5 +1,5 @@
import { extractZip } from "@actions/tool-cache"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { extractZip } from "../utils/setup/extract"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin" import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
/** Get the platform name Ninja uses in their download links */ /** Get the platform name Ninja uses in their download links */

View File

@ -1,6 +1,5 @@
import { extractZip } from "@actions/tool-cache"
import { addBinExtension } from "../utils/extension/extension" import { addBinExtension } from "../utils/extension/extension"
import { extractTarByExe } from "../utils/setup/extract" import { extractTarByExe, extractZip } from "../utils/setup/extract"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin" import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
/** Get the platform name task uses in their download links */ /** Get the platform name task uses in their download links */

View File

@ -3,11 +3,12 @@ import { mkdirP } from "@actions/io"
import which from "which" import which from "which"
import { setupSevenZip } from "../../sevenzip/sevenzip" import { setupSevenZip } from "../../sevenzip/sevenzip"
import { warning } from "../io/io" import { warning } from "../io/io"
export { extractTar, extractXar, extract7z } from "@actions/tool-cache" export { extractTar, extractXar } from "@actions/tool-cache"
let sevenZip: string | undefined let sevenZip: string | undefined
export async function extractExe(file: string, dest: string) { /// Extract 7z using 7z
export async function extract7Zip(file: string, dest: string) {
await execa(await getSevenZip(), ["x", file, `-o${dest}`], { stdio: "inherit" }) await execa(await getSevenZip(), ["x", file, `-o${dest}`], { stdio: "inherit" })
return dest return dest
} }
@ -24,6 +25,16 @@ async function getSevenZip() {
return sevenZip return sevenZip
} }
/// Extract Exe using 7z
export async function extractExe(file: string, dest: string) {
return extract7Zip(file, dest)
}
/// Extract Zip using 7z
export async function extractZip(file: string, dest: string) {
return extract7Zip(file, dest)
}
export async function extractTarByExe(file: string, dest: string, flags = ["--strip-components=0"]) { export async function extractTarByExe(file: string, dest: string, flags = ["--strip-components=0"]) {
try { try {
await mkdirP(dest) await mkdirP(dest)