mirror of https://github.com/aminya/setup-cpp
Merge branch 'master' into fix/update-node
This commit is contained in:
commit
4fc7c95a44
|
@ -75,6 +75,7 @@ words:
|
||||||
- tsbuildinfo
|
- tsbuildinfo
|
||||||
- ucrt
|
- ucrt
|
||||||
- untildify
|
- untildify
|
||||||
|
- upleveled
|
||||||
- vbatts
|
- vbatts
|
||||||
- vcpkg
|
- vcpkg
|
||||||
- vcvarsall
|
- vcvarsall
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b10f2e841835b93cee67dff1eb70d6fa5c0ac0cd
|
Subproject commit c30589196b2c59a3055dfc7c24244b4a1f48b081
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
import { node } from "execa"
|
import { execaNode } from "execa"
|
||||||
|
|
||||||
function getPlatformName() {
|
function getPlatformName() {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
|
@ -27,7 +27,7 @@ function main() {
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
exes.map((exe) =>
|
exes.map((exe) =>
|
||||||
node("./node_modules/caxa/build/index.mjs", [
|
execaNode("./node_modules/caxa/build/index.mjs", [
|
||||||
"--input",
|
"--input",
|
||||||
"./dist/node16",
|
"./dist/node16",
|
||||||
"--output",
|
"--output",
|
||||||
|
|
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
47
package.json
47
package.json
|
@ -9,9 +9,6 @@
|
||||||
"import": "./dist/node16/setup-cpp.mjs",
|
"import": "./dist/node16/setup-cpp.mjs",
|
||||||
"require": "./dist/node16/setup-cpp.js"
|
"require": "./dist/node16/setup-cpp.js"
|
||||||
},
|
},
|
||||||
"main": "./dist/node16/setup-cpp.js",
|
|
||||||
"main.legacy": "./dist/node12/setup-cpp.js",
|
|
||||||
"main.actions": "./dist/node18/setup-cpp.js",
|
|
||||||
"source": "./src/main.ts",
|
"source": "./src/main.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
"setup-cpp": "./dist/node16/setup-cpp.js"
|
"setup-cpp": "./dist/node16/setup-cpp.js"
|
||||||
|
@ -33,8 +30,8 @@
|
||||||
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
|
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
|
||||||
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
|
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
|
||||||
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
|
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
|
||||||
"build.parcel": "cross-env NODE_ENV=production parcel build",
|
"build.parcel": "cross-env NODE_ENV=production parcel build && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true",
|
||||||
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update",
|
"bump": "ncu -u -x numerous && pnpm update",
|
||||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||||
"copy.matchers": "run-p copy.matchers.node12 copy.matchers.node16 copy.matchers.node18",
|
"copy.matchers": "run-p copy.matchers.node12 copy.matchers.node16 copy.matchers.node18",
|
||||||
"copy.matchers.node12": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/",
|
"copy.matchers.node12": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/",
|
||||||
|
@ -69,18 +66,20 @@
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^1.1.3",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
"@npmcli/ci-detect": "^3.0.2",
|
"@babel/cli": "^7.21.0",
|
||||||
"@types/cross-spawn": "^6.0.2",
|
"@types/cross-spawn": "^6.0.2",
|
||||||
"@types/eslint": "^8.37.0",
|
"@types/eslint": "^8.37.0",
|
||||||
"@types/jest": "^29.5.1",
|
"@types/jest": "^29.5.1",
|
||||||
"@types/mri": "^1.1.1",
|
"@types/mri": "^1.1.1",
|
||||||
"@types/node": "^18.15.13",
|
"@types/node": "^18.16.0",
|
||||||
"@types/npmcli__ci-detect": "^2.0.0",
|
"@types/npmcli__ci-detect": "^2.0.0",
|
||||||
"@types/prettier": "2.7.2",
|
"@types/prettier": "2.7.2",
|
||||||
"@types/semver": "^7.3.13",
|
"@types/semver": "^7.3.13",
|
||||||
"@types/which": "^3.0.0",
|
"@types/which": "^3.0.0",
|
||||||
|
"@upleveled/babel-plugin-remove-node-prefix": "github:aminya/babel-plugin-remove-node-prefix#95fcbd92405b99a6eece48c493548996f12e6519",
|
||||||
"admina": "^0.1.3",
|
"admina": "^0.1.3",
|
||||||
"caxa": "^3.0.1",
|
"caxa": "^3.0.1",
|
||||||
|
"ci-info": "^3.8.0",
|
||||||
"ci-log": "workspace:*",
|
"ci-log": "workspace:*",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
|
@ -88,10 +87,11 @@
|
||||||
"escape-path-with-spaces": "^1.0.2",
|
"escape-path-with-spaces": "^1.0.2",
|
||||||
"escape-quotes": "^1.0.2",
|
"escape-quotes": "^1.0.2",
|
||||||
"escape-string-regexp": "^5.0.0",
|
"escape-string-regexp": "^5.0.0",
|
||||||
"eslint": "^8.38.0",
|
"eslint": "^8.39.0",
|
||||||
"eslint-config-atomic": "^1.18.3",
|
"eslint-config-atomic": "^1.18.3",
|
||||||
"exec-powershell": "workspace:*",
|
"exec-powershell": "workspace:*",
|
||||||
"execa": "^5.1.1",
|
"execa": "^7.1.1",
|
||||||
|
"fast-glob": "^3.2.12",
|
||||||
"gen-readme": "^1.6.0",
|
"gen-readme": "^1.6.0",
|
||||||
"is-url-online": "^1.5.0",
|
"is-url-online": "^1.5.0",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
|
@ -101,14 +101,14 @@
|
||||||
"npm-run-all2": "^6.0.5",
|
"npm-run-all2": "^6.0.5",
|
||||||
"numerous": "1.0.3",
|
"numerous": "1.0.3",
|
||||||
"parcel": "2.8.3",
|
"parcel": "2.8.3",
|
||||||
"path-exists": "^4.0.0",
|
"path-exists": "^5.0.0",
|
||||||
"patha": "^0.4.1",
|
"patha": "^0.4.1",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.8.8",
|
||||||
"prettier-config-atomic": "^3.1.0",
|
"prettier-config-atomic": "^3.1.0",
|
||||||
"quote-unquote": "^1.0.0",
|
"quote-unquote": "^1.0.0",
|
||||||
"readme-md-generator": "^1.0.0",
|
"readme-md-generator": "^1.0.0",
|
||||||
"retry-as-promised": "^7.0.4",
|
"retry-as-promised": "^7.0.4",
|
||||||
"semver": "7.3.8",
|
"semver": "7.5.0",
|
||||||
"setup-python": "github:actions/setup-python#v4.6.0",
|
"setup-python": "github:actions/setup-python#v4.6.0",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
"terser-config-atomic": "^0.1.1",
|
"terser-config-atomic": "^0.1.1",
|
||||||
|
@ -148,26 +148,9 @@
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"patha": "patha/dist/index.node.mjs"
|
"patha": "patha/dist/index.node.mjs"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"main": "./dist/node16/setup-cpp.js",
|
||||||
"overrides": {
|
"main.legacy": "./dist/node12/setup-cpp.js",
|
||||||
"semver": "7.3.8",
|
"main.actions": "./dist/node18/setup-cpp.js",
|
||||||
"eslint": "^8.28.0",
|
|
||||||
"prettier": "2.7.1",
|
|
||||||
"lru-cache": "7.8.1",
|
|
||||||
"core-js": "*",
|
|
||||||
"babel-eslint": "npm:@babel/eslint-parser",
|
|
||||||
"got@<11.8.5": ">=11.8.5",
|
|
||||||
"minimist@<0.2.1": ">=0.2.1",
|
|
||||||
"http-cache-semantics@<4.1.1": ">=4.1.1",
|
|
||||||
"minimist@<0.2.4": ">=0.2.4",
|
|
||||||
"deep-extend@<0.5.1": ">=0.5.1"
|
|
||||||
},
|
|
||||||
"peerDependencyRules": {
|
|
||||||
"allowedVersions": {
|
|
||||||
"eslint": "*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"targets": {
|
"targets": {
|
||||||
"main.legacy": {
|
"main.legacy": {
|
||||||
"context": "node",
|
"context": "node",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
|
|
||||||
export function error(err: string | Error) {
|
export function error(err: string | Error) {
|
||||||
return ciDetect() === "github-actions" ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`)
|
return GITHUB_ACTIONS ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function success(msg: string) {
|
export function success(msg: string) {
|
||||||
|
@ -10,13 +10,13 @@ export function success(msg: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function warning(msg: string) {
|
export function warning(msg: string) {
|
||||||
return ciDetect() === "github-actions" ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
|
return GITHUB_ACTIONS ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function notice(msg: string) {
|
export function notice(msg: string) {
|
||||||
return ciDetect() === "github-actions" ? core.notice(msg) : console.log(`\x1b[94m${msg}\x1b[0m`)
|
return GITHUB_ACTIONS ? core.notice(msg) : console.log(`\x1b[94m${msg}\x1b[0m`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function info(msg: string) {
|
export function info(msg: string) {
|
||||||
return ciDetect() === "github-actions" ? core.info(msg) : console.log(msg)
|
return GITHUB_ACTIONS ? core.info(msg) : console.log(msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ Execute a powershell command.
|
||||||
|
|
||||||
- command (`string`) - The powershell command to execute
|
- command (`string`) - The powershell command to execute
|
||||||
- startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first.
|
- startupFlags (`string[]`) - The optional startup flags to be passed to powershell. Defaults to `["-NoProfile", "-NoLogo", "-NonInteractive"]`. This means that the Powershell profile is not sourced first.
|
||||||
- execOptions (`execa.SyncOptions`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }`
|
- execOptions (`execaSyncOptions`) - The options passed to `execa`. Defaults to `{ stdio: "inherit" }`
|
||||||
|
|
||||||
**returns:** execa.ExecaSyncReturnValue<string>
|
**returns:** execa.ExecaSyncReturnValue<string>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"execa": "^5.1.1",
|
"execa": "^7.1.1",
|
||||||
"which": "^2.0.2"
|
"which": "^2.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import execa from "execa"
|
import * as execa from "execa"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
|
||||||
/** The cached powershell path */
|
/** The cached powershell path */
|
||||||
|
@ -19,7 +19,7 @@ export function execPowershell(
|
||||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||||
execOptions: execa.Options = { stdio: "inherit" }
|
execOptions: execa.Options = { stdio: "inherit" }
|
||||||
): execa.ExecaChildProcess<string> {
|
): execa.ExecaChildProcess<string> {
|
||||||
return execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
return execa.execa(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,7 +37,7 @@ export function execPowershellSync(
|
||||||
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
startupFlags: string[] = ["-NoProfile", "-NoLogo", "-NonInteractive"],
|
||||||
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
execOptions: execa.SyncOptions = { stdio: "inherit" }
|
||||||
): execa.ExecaSyncReturnValue<string> {
|
): execa.ExecaSyncReturnValue<string> {
|
||||||
return execa.sync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
return execa.execaSync(getPowerShell(), [...startupFlags, "-c", command], execOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
829
pnpm-lock.yaml
829
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import { dirname } from "patha"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
|
@ -28,7 +28,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
|
||||||
const brewTempDirectory = path.join(tmpdir(), "setup-cpp", "brew")
|
const brewTempDirectory = path.join(tmpdir(), "setup-cpp", "brew")
|
||||||
await mkdirP(brewTempDirectory)
|
await mkdirP(brewTempDirectory)
|
||||||
|
|
||||||
execa.sync("curl", ["-LJO", "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"], {
|
execaSync("curl", ["-LJO", "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"], {
|
||||||
cwd: brewTempDirectory,
|
cwd: brewTempDirectory,
|
||||||
})
|
})
|
||||||
const installSh = join(brewTempDirectory, "install.sh")
|
const installSh = join(brewTempDirectory, "install.sh")
|
||||||
|
@ -39,7 +39,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
|
||||||
installShContent.replace("#!/bin/bash", "")
|
installShContent.replace("#!/bin/bash", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
execa.sync("/bin/bash", [installSh], {
|
execaSync("/bin/bash", [installSh], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
env: {
|
env: {
|
||||||
NONINTERACTIVE: "1",
|
NONINTERACTIVE: "1",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
|
import { pathExists } from "path-exists"
|
||||||
import pathExists from "path-exists"
|
|
||||||
import { dirname } from "patha"
|
import { dirname } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
|
@ -40,7 +39,7 @@ export async function setupChocolatey(
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe
|
// https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe
|
||||||
execa.sync(
|
execaSync(
|
||||||
powershell,
|
powershell,
|
||||||
[
|
[
|
||||||
"-NoProfile",
|
"-NoProfile",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setupCmake } from "../cmake"
|
import { setupCmake } from "../cmake"
|
||||||
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
|
@ -19,7 +19,7 @@ describe("setup-cmake", () => {
|
||||||
it("should find CMake in the cache", async () => {
|
it("should find CMake in the cache", async () => {
|
||||||
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
|
const { binDir } = await setupCmake(getVersion("cmake", "true"), directory, process.arch)
|
||||||
await testBin("cmake", ["--version"], binDir)
|
await testBin("cmake", ["--version"], binDir)
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { isArch } from "../utils/env/isArch"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import retry from "retry-as-promised"
|
import retry from "retry-as-promised"
|
||||||
|
|
||||||
/** Get the platform data for cmake */
|
/** Get the platform data for cmake */
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
|
||||||
import { setupGcc } from "../gcc"
|
import { setupGcc } from "../gcc"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import { join, addExeExt } from "patha"
|
import { join, addExeExt } from "patha"
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ describe("setup-gcc", () => {
|
||||||
// test compilation
|
// test compilation
|
||||||
const file = join(__dirname, "main.cpp")
|
const file = join(__dirname, "main.cpp")
|
||||||
const main_exe = join(__dirname, addExeExt("main"))
|
const main_exe = join(__dirname, addExeExt("main"))
|
||||||
execa.sync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
execaSync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
chmodSync(main_exe, "755")
|
||||||
}
|
}
|
||||||
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
@ -9,14 +9,14 @@ import semverCoerce from "semver/functions/coerce"
|
||||||
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
|
||||||
import { join, addExeExt } from "patha"
|
import { join, addExeExt } from "patha"
|
||||||
import { warning, info } from "ci-log"
|
import { warning, info } from "ci-log"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
|
||||||
import { extract7Zip } from "../utils/setup/extract"
|
import { extract7Zip } from "../utils/setup/extract"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
interface MingwInfo {
|
interface MingwInfo {
|
||||||
releaseName: string
|
releaseName: string
|
||||||
|
@ -197,7 +197,7 @@ async function activateGcc(version: string, binDir: string) {
|
||||||
|
|
||||||
promises.push(setupMacOSSDK())
|
promises.push(setupMacOSSDK())
|
||||||
|
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
await addGccLoggingMatcher()
|
await addGccLoggingMatcher()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ describe("setup-Kcov", () => {
|
||||||
|
|
||||||
// it("should find Kcov in the cache", async () => {
|
// it("should find Kcov in the cache", async () => {
|
||||||
// const binDir = await testKcov("v39", directory)
|
// const binDir = await testKcov("v39", directory)
|
||||||
// if (ciDetect() === "github-actions") {
|
// if (GITHUB_ACTIONS) {
|
||||||
// expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
// expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||||
// }
|
// }
|
||||||
// await cleanupTmpDir("kcov-v39")
|
// await cleanupTmpDir("kcov-v39")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import execa from "execa"
|
import { execa } from "execa"
|
||||||
import { join, addExeExt } from "patha"
|
import { join, addExeExt } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupCmake } from "../cmake/cmake"
|
import { setupCmake } from "../cmake/cmake"
|
||||||
|
|
|
@ -2,8 +2,8 @@ import { setupLLVM, setupClangTools } from "../llvm"
|
||||||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isUrlOnline } from "is-url-online"
|
||||||
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import path, { addExeExt } from "patha"
|
import path, { addExeExt } from "patha"
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
|
@ -56,6 +56,7 @@ describe("setup-llvm", () => {
|
||||||
it("Finds valid LLVM URLs", async () => {
|
it("Finds valid LLVM URLs", async () => {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
[
|
[
|
||||||
|
...(process.platform === "darwin" ? [] : ["16.0.2", "16.0.0"]),
|
||||||
"15.0.2",
|
"15.0.2",
|
||||||
// "14.0.1",
|
// "14.0.1",
|
||||||
"14.0.0",
|
"14.0.0",
|
||||||
|
@ -91,11 +92,11 @@ describe("setup-llvm", () => {
|
||||||
// test compilation
|
// test compilation
|
||||||
const file = path.join(__dirname, "main.cpp")
|
const file = path.join(__dirname, "main.cpp")
|
||||||
const main_exe = path.join(__dirname, addExeExt("main"))
|
const main_exe = path.join(__dirname, addExeExt("main"))
|
||||||
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
execaSync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
chmodSync(main_exe, "755")
|
||||||
}
|
}
|
||||||
execa.sync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should find llvm in the cache", async () => {
|
it("should find llvm in the cache", async () => {
|
||||||
|
@ -103,7 +104,7 @@ describe("setup-llvm", () => {
|
||||||
const { binDir } = await setupLLVM(getVersion("llvm", "true", osVersion), directory, process.arch)
|
const { binDir } = await setupLLVM(getVersion("llvm", "true", osVersion), directory, process.arch)
|
||||||
await testBin("clang++", ["--version"], binDir)
|
await testBin("clang++", ["--version"], binDir)
|
||||||
|
|
||||||
if (ciDetect() === "github-actions" && process.platform !== "linux") {
|
if (GITHUB_ACTIONS && process.platform !== "linux") {
|
||||||
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||||
// TODO returns the install dir on linux
|
// TODO returns the install dir on linux
|
||||||
}
|
}
|
||||||
|
@ -111,7 +112,7 @@ describe("setup-llvm", () => {
|
||||||
expect(process.env.CC?.includes("clang")).toBeTruthy()
|
expect(process.env.CC?.includes("clang")).toBeTruthy()
|
||||||
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
||||||
|
|
||||||
if (ciDetect() === "github-actions" && process.platform !== "linux") {
|
if (GITHUB_ACTIONS && process.platform !== "linux") {
|
||||||
expect(process.env.CC).toMatch("hostedtoolcache")
|
expect(process.env.CC).toMatch("hostedtoolcache")
|
||||||
expect(process.env.CXX).toMatch("hostedtoolcache")
|
expect(process.env.CXX).toMatch("hostedtoolcache")
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ import { addEnv } from "../utils/env/addEnv"
|
||||||
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
|
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { setupGcc } from "../gcc/gcc"
|
import { setupGcc } from "../gcc/gcc"
|
||||||
import { getVersion } from "../versions/versions"
|
import { getVersion } from "../versions/versions"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { getLLVMPackageInfo } from "./llvm_url"
|
import { getLLVMPackageInfo } from "./llvm_url"
|
||||||
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../utils/env/ubuntu_version"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { ExecaReturnValue } from "execa"
|
import { ExecaReturnValue } from "execa"
|
||||||
|
|
||||||
export async function setupLLVM(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
|
export async function setupLLVM(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
|
||||||
|
@ -115,7 +115,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
await addLLVMLoggingMatcher()
|
await addLLVMLoggingMatcher()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ export async function activateLLVM(directory: string, versionGiven: string) {
|
||||||
|
|
||||||
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
|
/** Setup llvm tools (clang tidy, clang format, etc) without activating llvm and using it as the compiler */
|
||||||
export async function setupClangTools(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
|
export async function setupClangTools(version: string, setupDir: string, arch: string): Promise<InstallationInfo> {
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
await addLLVMLoggingMatcher()
|
await addLLVMLoggingMatcher()
|
||||||
}
|
}
|
||||||
return setupLLVMWithoutActivation(version, setupDir, arch)
|
return setupLLVMWithoutActivation(version, setupDir, arch)
|
||||||
|
|
|
@ -61,6 +61,10 @@ export const VERSIONS: Set<string> = getVersions([
|
||||||
"15.0.4",
|
"15.0.4",
|
||||||
"15.0.5",
|
"15.0.5",
|
||||||
"15.0.6",
|
"15.0.6",
|
||||||
|
"15.0.7",
|
||||||
|
"16.0.0",
|
||||||
|
"16.0.1",
|
||||||
|
"16.0.2",
|
||||||
])
|
])
|
||||||
|
|
||||||
/** The LLVM versions that were never released for the Windows platform. */
|
/** The LLVM versions that were never released for the Windows platform. */
|
||||||
|
@ -81,9 +85,14 @@ const DARWIN_MISSING = new Set([
|
||||||
"11.0.1",
|
"11.0.1",
|
||||||
"11.1.0",
|
"11.1.0",
|
||||||
"12.0.1",
|
"12.0.1",
|
||||||
|
// missing x86_64
|
||||||
|
// TODO add arm64 support
|
||||||
"15.0.4",
|
"15.0.4",
|
||||||
"15.0.5",
|
"15.0.5",
|
||||||
"15.0.6",
|
"15.0.6",
|
||||||
|
"16.0.0",
|
||||||
|
"16.0.1",
|
||||||
|
"16.0.2",
|
||||||
])
|
])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,6 +150,8 @@ const UBUNTU_SUFFIX_MAP: { [key: string]: string } = {
|
||||||
"15.0.2": "-rhel86",
|
"15.0.2": "-rhel86",
|
||||||
"15.0.5": "-ubuntu-18.04",
|
"15.0.5": "-ubuntu-18.04",
|
||||||
"15.0.6": "-ubuntu-18.04",
|
"15.0.6": "-ubuntu-18.04",
|
||||||
|
"16.0.0": "-ubuntu-18.04",
|
||||||
|
"16.0.2": "-ubuntu-22.04",
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
|
/** The latest supported LLVM version for the Linux (Ubuntu) platform. */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/* eslint-disable node/shebang */
|
/* eslint-disable node/shebang */
|
||||||
|
|
||||||
import { endGroup, getInput, notice, startGroup } from "@actions/core"
|
import { endGroup, getInput, notice, startGroup } from "@actions/core"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { error, info, success, warning } from "ci-log"
|
import { error, info, success, warning } from "ci-log"
|
||||||
import mri from "mri"
|
import mri from "mri"
|
||||||
import * as numerous from "numerous"
|
import * as numerous from "numerous"
|
||||||
|
@ -89,7 +89,7 @@ const inputs: Array<Inputs> = ["compiler", "architecture", ...tools]
|
||||||
|
|
||||||
/** The main entry function */
|
/** The main entry function */
|
||||||
export async function main(args: string[]): Promise<number> {
|
export async function main(args: string[]): Promise<number> {
|
||||||
if (ciDetect() !== "github-actions") {
|
if (!GITHUB_ACTIONS) {
|
||||||
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"
|
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ export async function main(args: string[]): Promise<number> {
|
||||||
|
|
||||||
info("setup-cpp finished")
|
info("setup-cpp finished")
|
||||||
|
|
||||||
if (ciDetect() !== "github-actions") {
|
if (!GITHUB_ACTIONS) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
warning("Run `RefreshEnv.cmd` or restart your shell to update the environment.")
|
warning("Run `RefreshEnv.cmd` or restart your shell to update the environment.")
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { setupVCVarsall } from "../vcvarsall/vcvarsall"
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
|
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
|
|
||||||
import { error, info, warning } from "ci-log"
|
import { error, info, warning } from "ci-log"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string
|
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ export async function setupMSVC(
|
||||||
// run vcvarsall.bat environment variables
|
// run vcvarsall.bat environment variables
|
||||||
await setupVCVarsall(version, VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
await setupVCVarsall(version, VCTargetsPath, arch, toolset, sdk, uwp, spectre)
|
||||||
|
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
await addMSVCLoggingMatcher()
|
await addMSVCLoggingMatcher()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setupNinja } from "../ninja"
|
import { setupNinja } from "../ninja"
|
||||||
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
|
@ -22,7 +22,7 @@ describe("setup-ninja", () => {
|
||||||
|
|
||||||
it("should find Ninja in the cache", async () => {
|
it("should find Ninja in the cache", async () => {
|
||||||
const binDir = await testNinja(directory)
|
const binDir = await testNinja(directory)
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { setupPowershell } from "../powershell"
|
import { setupPowershell } from "../powershell"
|
||||||
import { testBin } from "../../utils/tests/test-helpers"
|
import { testBin } from "../../utils/tests/test-helpers"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
describe("setup-powershell", () => {
|
describe("setup-powershell", () => {
|
||||||
it("should setup powershell", async () => {
|
it("should setup powershell", async () => {
|
||||||
if (process.platform === "win32" && ciDetect() === "github-actions") {
|
if (process.platform === "win32" && GITHUB_ACTIONS) {
|
||||||
// results in errors
|
// results in errors
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { setupPython } from "../python"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { info } from "ci-log"
|
import { info } from "ci-log"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
|
@ -13,7 +13,7 @@ describe("setup-python", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should setup python in GitHub Actions", async () => {
|
it("should setup python in GitHub Actions", async () => {
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
info("Installing python in GitHub Actions")
|
info("Installing python in GitHub Actions")
|
||||||
const { setupActionsPython } = await import("../actions_python")
|
const { setupActionsPython } = await import("../actions_python")
|
||||||
await setupActionsPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
|
await setupActionsPython(getVersion("python", "true", await ubuntuVersion()), directory, process.arch)
|
||||||
|
|
|
@ -4,10 +4,10 @@ import { findPyPyVersion } from "setup-python/src/find-pypy"
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import { debug } from "@actions/core"
|
import { debug } from "@actions/core"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils"
|
import { isCacheFeatureAvailable, IS_MAC } from "setup-python/src/utils"
|
||||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
return versionSpec.startsWith("pypy")
|
return versionSpec.startsWith("pypy")
|
||||||
|
@ -51,7 +51,7 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
await addPythonLoggingMatcher()
|
await addPythonLoggingMatcher()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { warning, info } from "ci-log"
|
import { warning, info } from "ci-log"
|
||||||
import { isArch } from "../utils/env/isArch"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
@ -16,11 +16,11 @@ import { getExecOutput } from "@actions/exec"
|
||||||
import { isBinUptoDate } from "../utils/setup/version"
|
import { isBinUptoDate } from "../utils/setup/version"
|
||||||
import { getVersion } from "../versions/versions"
|
import { getVersion } from "../versions/versions"
|
||||||
import assert from "assert"
|
import assert from "assert"
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import { unique } from "../utils/std"
|
import { unique } from "../utils/std"
|
||||||
|
|
||||||
export async function setupPython(version: string, setupDir: string, arch: string) {
|
export async function setupPython(version: string, setupDir: string, arch: string) {
|
||||||
if (ciDetect() !== "github-actions") {
|
if (!GITHUB_ACTIONS) {
|
||||||
// TODO parse version
|
// TODO parse version
|
||||||
return setupPythonViaSystem(version, setupDir, arch)
|
return setupPythonViaSystem(version, setupDir, arch)
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,12 @@ export async function setupPythonViaSystem(
|
||||||
} else if (isUbuntu()) {
|
} else if (isUbuntu()) {
|
||||||
installInfo = await setupAptPack([{ name: "python3", version }, { name: "python3-pip" }])
|
installInfo = await setupAptPack([{ name: "python3", version }, { name: "python3-pip" }])
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unsupported linux distributions`)
|
throw new Error("Unsupported linux distributions")
|
||||||
}
|
}
|
||||||
return installInfo
|
return installInfo
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
throw new Error(`Unsupported platform`)
|
throw new Error("Unsupported platform")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ export async function setupPythonAndPip(): Promise<string> {
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
// downgrade pip on Windows
|
// downgrade pip on Windows
|
||||||
// https://github.com/pypa/pip/issues/10875#issuecomment-1030293005
|
// https://github.com/pypa/pip/issues/10875#issuecomment-1030293005
|
||||||
execa.sync(foundPython, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" })
|
execaSync(foundPython, ["-m", "pip", "install", "-U", "pip==21.3.1"], { stdio: "inherit" })
|
||||||
} else if (process.platform === "linux") {
|
} else if (process.platform === "linux") {
|
||||||
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||||
if (isArch()) {
|
if (isArch()) {
|
||||||
|
@ -122,7 +122,7 @@ export async function setupPythonAndPip(): Promise<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// install wheel (required for Conan, Meson, etc.)
|
// install wheel (required for Conan, Meson, etc.)
|
||||||
execa.sync(foundPython, ["-m", "pip", "install", "-U", "wheel"], { stdio: "inherit" })
|
execaSync(foundPython, ["-m", "pip", "install", "-U", "wheel"], { stdio: "inherit" })
|
||||||
|
|
||||||
return foundPython
|
return foundPython
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { setupTask } from "../task"
|
import { setupTask } from "../task"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { getVersion } from "../../versions/versions"
|
import { getVersion } from "../../versions/versions"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
|
@ -18,7 +18,7 @@ describe("setup-task", () => {
|
||||||
|
|
||||||
it("should find task in the cache", async () => {
|
it("should find task in the cache", async () => {
|
||||||
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)
|
const { binDir } = await setupTask(getVersion("task", "true"), directory, process.arch)
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
expect(binDir).toMatch(process.env.RUNNER_TOOL_CACHE ?? "hostedtoolcache")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/core"
|
import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/core"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { untildifyUser } from "untildify-user"
|
import { untildifyUser } from "untildify-user"
|
||||||
import { appendFileSync, readFileSync, writeFileSync } from "fs"
|
import { appendFileSync, readFileSync, writeFileSync } from "fs"
|
||||||
import { error, warning } from "ci-log"
|
import { error, warning } from "ci-log"
|
||||||
|
@ -8,7 +8,7 @@ import { delimiter } from "path"
|
||||||
import escapeSpace from "escape-path-with-spaces"
|
import escapeSpace from "escape-path-with-spaces"
|
||||||
import { giveUserAccess } from "user-access"
|
import { giveUserAccess } from "user-access"
|
||||||
import escapeQuote from "escape-quotes"
|
import escapeQuote from "escape-quotes"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an environment variable.
|
* Add an environment variable.
|
||||||
|
@ -18,7 +18,7 @@ import pathExists from "path-exists"
|
||||||
export async function addEnv(name: string, valGiven: string | undefined, shouldEscapeSpace: boolean = false) {
|
export async function addEnv(name: string, valGiven: string | undefined, shouldEscapeSpace: boolean = false) {
|
||||||
const val = escapeString(valGiven ?? "", shouldEscapeSpace)
|
const val = escapeString(valGiven ?? "", shouldEscapeSpace)
|
||||||
try {
|
try {
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
try {
|
try {
|
||||||
exportVariable(name, val)
|
exportVariable(name, val)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -47,7 +47,7 @@ function escapeString(valGiven: string, shouldEscapeSpace: boolean = false) {
|
||||||
export async function addPath(path: string) {
|
export async function addPath(path: string) {
|
||||||
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
|
process.env.PATH = `${path}${delimiter}${process.env.PATH}`
|
||||||
try {
|
try {
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
try {
|
try {
|
||||||
ghAddPath(path)
|
ghAddPath(path)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -69,7 +69,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
|
||||||
const val = valGiven ?? ""
|
const val = valGiven ?? ""
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit
|
// We do not use `execaSync(`setx PATH "${path};%PATH%"`)` because of its character limit
|
||||||
await execPowershell(`[Environment]::SetEnvironmentVariable('${name}', '${val}', "User")`)
|
await execPowershell(`[Environment]::SetEnvironmentVariable('${name}', '${val}', "User")`)
|
||||||
info(`${name}='${val}' was set in the environment.`)
|
info(`${name}='${val}' was set in the environment.`)
|
||||||
return
|
return
|
||||||
|
@ -91,7 +91,7 @@ async function addEnvSystem(name: string, valGiven: string | undefined) {
|
||||||
async function addPathSystem(path: string) {
|
async function addPathSystem(path: string) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
// We do not use `execaSync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
|
||||||
await execPowershell(
|
await execPowershell(
|
||||||
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import execa from "execa"
|
import { execa } from "execa"
|
||||||
import { mkdirP } from "@actions/io"
|
import { mkdirP } from "@actions/io"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupSevenZip } from "../../sevenzip/sevenzip"
|
import { setupSevenZip } from "../../sevenzip/sevenzip"
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import { execRoot, execRootSync } from "admina"
|
import { execRoot, execRootSync } from "admina"
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
import { addEnv, cpprc_path, setupCppInProfile } from "../env/addEnv"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import { promises as fsPromises } from "fs"
|
import { promises as fsPromises } from "fs"
|
||||||
const { appendFile } = fsPromises
|
const { appendFile } = fsPromises
|
||||||
import execa from "execa"
|
import { execa } from "execa"
|
||||||
import escapeRegex from "escape-string-regexp"
|
import escapeRegex from "escape-string-regexp"
|
||||||
|
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
@ -149,7 +149,7 @@ export async function addAptKeyViaDownload(name: string, url: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateAptAlternatives(name: string, path: string) {
|
export async function updateAptAlternatives(name: string, path: string) {
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
return execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
return execRoot("update-alternatives", ["--install", `/usr/bin/${name}`, name, path, "40"])
|
||||||
} else {
|
} else {
|
||||||
await setupCppInProfile()
|
await setupCppInProfile()
|
||||||
|
|
|
@ -4,14 +4,14 @@ import { join } from "patha"
|
||||||
import { info } from "ci-log"
|
import { info } from "ci-log"
|
||||||
|
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
import ciDetect from "@npmcli/ci-detect"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { setupAptPack } from "./setupAptPack"
|
import { setupAptPack } from "./setupAptPack"
|
||||||
import { setupPacmanPack } from "./setupPacmanPack"
|
import { setupPacmanPack } from "./setupPacmanPack"
|
||||||
import { isArch } from "../env/isArch"
|
import { isArch } from "../env/isArch"
|
||||||
import { hasDnf } from "../env/hasDnf"
|
import { hasDnf } from "../env/hasDnf"
|
||||||
import { setupDnfPack } from "./setupDnfPack"
|
import { setupDnfPack } from "./setupDnfPack"
|
||||||
import { isUbuntu } from "../env/isUbuntu"
|
import { isUbuntu } from "../env/isUbuntu"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
import retry from "retry-as-promised"
|
import retry from "retry-as-promised"
|
||||||
|
|
||||||
/** A type that describes a package */
|
/** A type that describes a package */
|
||||||
|
@ -66,7 +66,7 @@ export async function setupBin(
|
||||||
)
|
)
|
||||||
|
|
||||||
// Restore from cache (if found).
|
// Restore from cache (if found).
|
||||||
if (ciDetect() === "github-actions") {
|
if (GITHUB_ACTIONS) {
|
||||||
try {
|
try {
|
||||||
const dir = find(name, version)
|
const dir = find(name, version)
|
||||||
if (dir) {
|
if (dir) {
|
||||||
|
@ -136,7 +136,7 @@ export async function setupBin(
|
||||||
await addPath(binDir)
|
await addPath(binDir)
|
||||||
|
|
||||||
// check if inside Github Actions. If so, cache the installation
|
// check if inside Github Actions. If so, cache the installation
|
||||||
if (ciDetect() === "github-actions" && typeof process.env.RUNNER_TOOL_CACHE === "string") {
|
if (GITHUB_ACTIONS && typeof process.env.RUNNER_TOOL_CACHE === "string") {
|
||||||
await cacheDir(setupDir, name, version)
|
await cacheDir(setupDir, name, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import { join } from "patha"
|
import { join } from "patha"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { getBrewPath, setupBrew } from "../../brew/brew"
|
import { getBrewPath, setupBrew } from "../../brew/brew"
|
||||||
|
@ -24,7 +24,7 @@ export async function setupBrewPack(
|
||||||
const binDir = getBrewPath()
|
const binDir = getBrewPath()
|
||||||
|
|
||||||
// brew is not thread-safe
|
// brew is not thread-safe
|
||||||
execa.sync(
|
execaSync(
|
||||||
join(binDir, "brew"),
|
join(binDir, "brew"),
|
||||||
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
|
["install", version !== undefined && version !== "" ? `${name}@${version}` : name, ...extraArgs],
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { addPath } from "../env/addEnv"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { InstallationInfo } from "./setupBin"
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import { notice } from "ci-log"
|
import { notice } from "ci-log"
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@ export async function setupChocoPack(name: string, version?: string, args: strin
|
||||||
env.PATH = PATH
|
env.PATH = PATH
|
||||||
|
|
||||||
if (version !== undefined && version !== "") {
|
if (version !== undefined && version !== "") {
|
||||||
execa.sync("choco", ["install", "-y", name, `--version=${version}`, ...args], {
|
execaSync("choco", ["install", "-y", name, `--version=${version}`, ...args], {
|
||||||
env,
|
env,
|
||||||
extendEnv: false,
|
extendEnv: false,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
execa.sync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
|
execaSync("choco", ["install", "-y", name, ...args], { env, extendEnv: false, stdio: "inherit" })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// if the package requires a reboot, downgrade the error to a notice
|
// if the package requires a reboot, downgrade the error to a notice
|
||||||
if ((err as Error).message.includes("exit code 3010")) {
|
if ((err as Error).message.includes("exit code 3010")) {
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
import execa from "execa"
|
|
||||||
import { info } from "@actions/core"
|
import { info } from "@actions/core"
|
||||||
import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
|
import { execaSync } from "execa"
|
||||||
import { InstallationInfo } from "./setupBin"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
import { addExeExt, dirname, join } from "patha"
|
import { addExeExt, dirname, join } from "patha"
|
||||||
import { addPath } from "../env/addEnv"
|
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import pathExists from "path-exists"
|
import { addPythonBaseExecPrefix, setupPythonAndPip } from "../../python/python"
|
||||||
|
import { addPath } from "../env/addEnv"
|
||||||
|
import { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
let python: string | undefined
|
let python: string | undefined
|
||||||
let binDirs: string[] | undefined
|
let binDirs: string[] | undefined
|
||||||
|
@ -20,7 +19,7 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
||||||
python = await setupPythonAndPip()
|
python = await setupPythonAndPip()
|
||||||
}
|
}
|
||||||
|
|
||||||
execa.sync(python, ["-m", "pip", "install", version !== undefined && version !== "" ? `${name}==${version}` : name], {
|
execaSync(python, ["-m", "pip", "install", version !== undefined && version !== "" ? `${name}==${version}` : name], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as path from "patha"
|
||||||
import { addExeExt, join } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
import spawn from "cross-spawn"
|
import spawn from "cross-spawn"
|
||||||
|
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
export async function setupTmpDir(testName: string) {
|
export async function setupTmpDir(testName: string) {
|
||||||
const tempDirectory = path.join(tmpdir(), "setup cpp temp", testName)
|
const tempDirectory = path.join(tmpdir(), "setup cpp temp", testName)
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
import execa from "execa"
|
import { execaSync } from "execa"
|
||||||
|
import { notice } from "ci-log"
|
||||||
import { dirname, join, addShExt, addShRelativePrefix } from "patha"
|
import { pathExists } from "path-exists"
|
||||||
|
import { addShExt, addShRelativePrefix, dirname, join } from "patha"
|
||||||
|
import { giveUserAccess } from "user-access"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { notice } from "ci-log"
|
|
||||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
|
||||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
|
||||||
import { isArch } from "../utils/env/isArch"
|
|
||||||
import { hasDnf } from "../utils/env/hasDnf"
|
import { hasDnf } from "../utils/env/hasDnf"
|
||||||
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
import { isArch } from "../utils/env/isArch"
|
||||||
import { isUbuntu } from "../utils/env/isUbuntu"
|
import { isUbuntu } from "../utils/env/isUbuntu"
|
||||||
import { giveUserAccess } from "user-access"
|
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import pathExists from "path-exists"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
|
import { setupDnfPack } from "../utils/setup/setupDnfPack"
|
||||||
|
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
|
||||||
|
|
||||||
let hasVCPKG = false
|
let hasVCPKG = false
|
||||||
|
|
||||||
|
@ -48,12 +47,12 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
|
if (!(await pathExists(join(setupDir, addShExt("bootstrap-vcpkg", ".bat"))))) {
|
||||||
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
execaSync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
|
||||||
} else {
|
} else {
|
||||||
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
|
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
execa.sync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
|
execaSync(addShExt(addShRelativePrefix("bootstrap-vcpkg"), ".bat"), {
|
||||||
cwd: setupDir,
|
cwd: setupDir,
|
||||||
shell: true,
|
shell: true,
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
|
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
|
||||||
import { addEnv } from "../utils/env/addEnv"
|
import { addEnv } from "../utils/env/addEnv"
|
||||||
import { info } from "ci-log"
|
import { info } from "ci-log"
|
||||||
import pathExists from "path-exists"
|
import { pathExists } from "path-exists"
|
||||||
|
|
||||||
function getArch(arch: string): string {
|
function getArch(arch: string): string {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
|
|
Loading…
Reference in New Issue