mirror of https://github.com/aminya/setup-cpp
Merge pull request #198 from aminya/fixes [skip ci]
This commit is contained in:
commit
771f77f24f
|
@ -0,0 +1,2 @@
|
||||||
|
const { buildTerserOptions } = require("terser-config-atomic/dist/builder")
|
||||||
|
module.exports = buildTerserOptions(process.env.NODE_ENV, undefined, true)
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -119,8 +119,8 @@
|
||||||
"setup-python": "github:actions/setup-python#v4.7.0",
|
"setup-python": "github:actions/setup-python#v4.7.0",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
"simple-update-notifier": "^2.0.0",
|
"simple-update-notifier": "^2.0.0",
|
||||||
|
"terser-config-atomic": "^1.0.0",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
"ts-jest": "^29.1.1",
|
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"ts-readme": "^1.1.3",
|
"ts-readme": "^1.1.3",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
|
|
|
@ -18,7 +18,7 @@ npm install --save user-access
|
||||||
|
|
||||||
<!-- INSERT GENERATED DOCS START -->
|
<!-- INSERT GENERATED DOCS START -->
|
||||||
|
|
||||||
### `giveUserAccess` (function)
|
### `grantUserWriteAccess` (function)
|
||||||
|
|
||||||
Give the user access to the given path and its sub-directories. It changes the owner to the SUDO_USER. This allows
|
Give the user access to the given path and its sub-directories. It changes the owner to the SUDO_USER. This allows
|
||||||
the user to use the folder without sudo
|
the user to use the folder without sudo
|
||||||
|
@ -27,7 +27,7 @@ the user to use the folder without sudo
|
||||||
|
|
||||||
- path (`string`) - The path to give the user access to
|
- path (`string`) - The path to give the user access to
|
||||||
|
|
||||||
**returns:** void
|
**returns:** Promise<void>
|
||||||
|
|
||||||
<!-- INSERT GENERATED DOCS END -->
|
<!-- INSERT GENERATED DOCS END -->
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { isSudo, execRootSync } from "admina"
|
import { isSudo, execRoot } from "admina"
|
||||||
import { statSync } from "fs"
|
import { statSync } from "fs"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -7,14 +7,14 @@ import { statSync } from "fs"
|
||||||
*
|
*
|
||||||
* @param path The path to give the user access to
|
* @param path The path to give the user access to
|
||||||
*/
|
*/
|
||||||
export function giveUserAccess(path: string) {
|
export async function grantUserWriteAccess(path: string) {
|
||||||
if (
|
if (
|
||||||
(process.platform === "linux" || process.platform === "darwin") &&
|
(process.platform === "linux" || process.platform === "darwin") &&
|
||||||
isSudo() &&
|
isSudo() &&
|
||||||
process.env.SUDO_USER !== undefined
|
process.env.SUDO_USER !== undefined
|
||||||
) {
|
) {
|
||||||
const isDirectory = statSync(path).isDirectory()
|
const isDirectory = statSync(path).isDirectory()
|
||||||
execRootSync("chown", [...(isDirectory ? ["-R"] : []), process.env.SUDO_USER, path], {
|
await execRoot("chown", [...(isDirectory ? ["-R"] : []), process.env.SUDO_USER, path], {
|
||||||
cwd: path,
|
cwd: path,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
shell: true,
|
shell: true,
|
||||||
|
|
|
@ -155,12 +155,12 @@ importers:
|
||||||
simple-update-notifier:
|
simple-update-notifier:
|
||||||
specifier: ^2.0.0
|
specifier: ^2.0.0
|
||||||
version: 2.0.0
|
version: 2.0.0
|
||||||
|
terser-config-atomic:
|
||||||
|
specifier: ^1.0.0
|
||||||
|
version: 1.0.0
|
||||||
time-delta:
|
time-delta:
|
||||||
specifier: github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
specifier: github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
||||||
version: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
version: github.com/aminya/time-delta/69d91a41cef28e569be9a2991129f5f7d1f0d00e
|
||||||
ts-jest:
|
|
||||||
specifier: ^29.1.1
|
|
||||||
version: 29.1.1(@babel/core@7.22.9)(jest@29.6.2)(typescript@5.1.6)
|
|
||||||
ts-node:
|
ts-node:
|
||||||
specifier: ^10.9.1
|
specifier: ^10.9.1
|
||||||
version: 10.9.1(@swc/core@1.3.73)(@types/node@20.4.5)(typescript@5.1.6)
|
version: 10.9.1(@swc/core@1.3.73)(@types/node@20.4.5)(typescript@5.1.6)
|
||||||
|
@ -3639,13 +3639,6 @@ packages:
|
||||||
update-browserslist-db: 1.0.11(browserslist@4.21.10)
|
update-browserslist-db: 1.0.11(browserslist@4.21.10)
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/bs-logger@0.2.6:
|
|
||||||
resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
dependencies:
|
|
||||||
fast-json-stable-stringify: 2.1.0
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/bser@2.1.1:
|
/bser@2.1.1:
|
||||||
resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==}
|
resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -7207,10 +7200,6 @@ packages:
|
||||||
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/lodash.memoize@4.1.2:
|
|
||||||
resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==}
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/lodash.merge@4.6.2:
|
/lodash.merge@4.6.2:
|
||||||
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -9424,6 +9413,10 @@ packages:
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/terser-config-atomic@1.0.0:
|
||||||
|
resolution: {integrity: sha512-WlhyFd4+honI08iaMxLg5P1eSg7RknCHzMI+AOwTNtMWkflGRrLHb7enbYmtpirUi05Tdun9wi/TNinNj4mrSg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/test-exclude@6.0.0:
|
/test-exclude@6.0.0:
|
||||||
resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
|
resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==}
|
||||||
engines: {node: '>=8'}
|
engines: {node: '>=8'}
|
||||||
|
@ -9492,40 +9485,6 @@ packages:
|
||||||
typescript: 5.1.6
|
typescript: 5.1.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/ts-jest@29.1.1(@babel/core@7.22.9)(jest@29.6.2)(typescript@5.1.6):
|
|
||||||
resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==}
|
|
||||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
|
||||||
hasBin: true
|
|
||||||
peerDependencies:
|
|
||||||
'@babel/core': '>=7.0.0-beta.0 <8'
|
|
||||||
'@jest/types': ^29.0.0
|
|
||||||
babel-jest: ^29.0.0
|
|
||||||
esbuild: '*'
|
|
||||||
jest: ^29.0.0
|
|
||||||
typescript: '>=4.3 <6'
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@babel/core':
|
|
||||||
optional: true
|
|
||||||
'@jest/types':
|
|
||||||
optional: true
|
|
||||||
babel-jest:
|
|
||||||
optional: true
|
|
||||||
esbuild:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@babel/core': 7.22.9
|
|
||||||
bs-logger: 0.2.6
|
|
||||||
fast-json-stable-stringify: 2.1.0
|
|
||||||
jest: 29.6.2(@types/node@20.4.5)(ts-node@10.9.1)
|
|
||||||
jest-util: 29.6.2
|
|
||||||
json5: 2.2.3
|
|
||||||
lodash.memoize: 4.1.2
|
|
||||||
make-error: 1.3.6
|
|
||||||
semver: 7.5.4
|
|
||||||
typescript: 5.1.6
|
|
||||||
yargs-parser: 21.1.1
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/ts-node@10.9.1(@swc/core@1.3.73)(@types/node@20.4.5)(typescript@5.1.6):
|
/ts-node@10.9.1(@swc/core@1.3.73)(@types/node@20.4.5)(typescript@5.1.6):
|
||||||
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
|
@ -276,4 +276,4 @@ async function addPythonBaseExecPrefix_raw(python: string) {
|
||||||
*
|
*
|
||||||
* The answer is cached for subsequent calls
|
* The answer is cached for subsequent calls
|
||||||
*/
|
*/
|
||||||
export const addPythonBaseExecPrefix = memoize(addPythonBaseExecPrefix_raw)
|
export const addPythonBaseExecPrefix = memoize(addPythonBaseExecPrefix_raw, { isPromise: true })
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { error, warning } from "ci-log"
|
||||||
import { execPowershell } from "exec-powershell"
|
import { execPowershell } from "exec-powershell"
|
||||||
import { delimiter } from "path"
|
import { delimiter } from "path"
|
||||||
import escapeSpace from "escape-path-with-spaces"
|
import escapeSpace from "escape-path-with-spaces"
|
||||||
import { giveUserAccess } from "user-access"
|
import { grantUserWriteAccess } from "user-access"
|
||||||
import escapeQuote from "escape-quotes"
|
import escapeQuote from "escape-quotes"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ export async function finalizeCpprc() {
|
||||||
writeFileSync(cpprc_path, unique_entries.join("\n"))
|
writeFileSync(cpprc_path, unique_entries.join("\n"))
|
||||||
|
|
||||||
try {
|
try {
|
||||||
giveUserAccess(cpprc_path)
|
grantUserWriteAccess(cpprc_path)
|
||||||
} catch {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ async function ubuntuVersion_raw(): Promise<number[] | null> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Detect Ubuntu version */
|
/** Detect Ubuntu version */
|
||||||
export const ubuntuVersion = memoize(ubuntuVersion_raw)
|
export const ubuntuVersion = memoize(ubuntuVersion_raw, { isPromise: true })
|
||||||
|
|
||||||
/** Detect Ubuntu version using os.version() for Ubuntu based distros */
|
/** Detect Ubuntu version using os.version() for Ubuntu based distros */
|
||||||
function detectUsingOsVersion() {
|
function detectUsingOsVersion() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ 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 "ci-log"
|
import { warning } from "ci-log"
|
||||||
import { giveUserAccess } from "user-access"
|
import { grantUserWriteAccess } from "user-access"
|
||||||
export { extractTar, extractXar } from "@actions/tool-cache"
|
export { extractTar, extractXar } from "@actions/tool-cache"
|
||||||
|
|
||||||
let sevenZip: string | undefined
|
let sevenZip: string | undefined
|
||||||
|
@ -11,7 +11,7 @@ let sevenZip: string | undefined
|
||||||
/// Extract 7z using 7z
|
/// Extract 7z using 7z
|
||||||
export async function extract7Zip(file: string, dest: string) {
|
export async function extract7Zip(file: string, dest: string) {
|
||||||
await execa(await getSevenZip(), ["x", file, `-o${dest}`, "-y"], { stdio: "inherit" })
|
await execa(await getSevenZip(), ["x", file, `-o${dest}`, "-y"], { stdio: "inherit" })
|
||||||
giveUserAccess(dest)
|
grantUserWriteAccess(dest)
|
||||||
return dest
|
return dest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,6 @@ export async function extractTarByExe(file: string, dest: string, flags = ["--st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
giveUserAccess(dest)
|
grantUserWriteAccess(dest)
|
||||||
return dest
|
return dest
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ async function getPython_raw(): Promise<string> {
|
||||||
}
|
}
|
||||||
return pythonBin
|
return pythonBin
|
||||||
}
|
}
|
||||||
const getPython = memoize(getPython_raw)
|
const getPython = memoize(getPython_raw, { isPromise: true })
|
||||||
|
|
||||||
async function pipHasPackage(python: string, name: string) {
|
async function pipHasPackage(python: string, name: string) {
|
||||||
const result = await execa(python, ["-m", "pip", "-qq", "index", "versions", name], {
|
const result = await execa(python, ["-m", "pip", "-qq", "index", "versions", name], {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { execaSync } from "execa"
|
||||||
import { notice } from "ci-log"
|
import { notice } from "ci-log"
|
||||||
import { pathExists } from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
|
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
|
||||||
import { giveUserAccess } from "user-access"
|
import { grantUserWriteAccess } from "user-access"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
|
@ -62,7 +62,7 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
|
|
||||||
giveUserAccess(setupDir)
|
grantUserWriteAccess(setupDir)
|
||||||
|
|
||||||
await addPath(setupDir)
|
await addPath(setupDir)
|
||||||
// eslint-disable-next-line require-atomic-updates
|
// eslint-disable-next-line require-atomic-updates
|
||||||
|
|
Loading…
Reference in New Issue