mirror of https://github.com/aminya/setup-cpp
fix: replace npmcli/ci-detect with ci-info
This commit is contained in:
parent
54a546118a
commit
ea04bfe6af
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
|
@ -32,7 +32,7 @@
|
||||||
"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",
|
||||||
"bump": "ncu -u -x numerous,path-exists && pnpm update",
|
"bump": "ncu -u -x execa,numerous,path-exists && pnpm update",
|
||||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||||
"copy.matchers": "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/ && shx cp ./dist/node12/*.json ./dist/node16/",
|
"copy.matchers": "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/ && shx cp ./dist/node12/*.json ./dist/node16/",
|
||||||
"dev": "cross-env NODE_ENV=development parcel watch",
|
"dev": "cross-env NODE_ENV=development parcel watch",
|
||||||
|
@ -64,7 +64,6 @@
|
||||||
"@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",
|
|
||||||
"@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",
|
||||||
|
@ -76,6 +75,7 @@
|
||||||
"@types/which": "^3.0.0",
|
"@types/which": "^3.0.0",
|
||||||
"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",
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,6 @@ importers:
|
||||||
'@actions/tool-cache':
|
'@actions/tool-cache':
|
||||||
specifier: ^2.0.1
|
specifier: ^2.0.1
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
'@npmcli/ci-detect':
|
|
||||||
specifier: ^3.0.2
|
|
||||||
version: 3.0.2
|
|
||||||
'@types/cross-spawn':
|
'@types/cross-spawn':
|
||||||
specifier: ^6.0.2
|
specifier: ^6.0.2
|
||||||
version: 6.0.2
|
version: 6.0.2
|
||||||
|
@ -59,6 +56,9 @@ importers:
|
||||||
caxa:
|
caxa:
|
||||||
specifier: ^3.0.1
|
specifier: ^3.0.1
|
||||||
version: 3.0.1
|
version: 3.0.1
|
||||||
|
ci-info:
|
||||||
|
specifier: ^3.8.0
|
||||||
|
version: 3.8.0
|
||||||
ci-log:
|
ci-log:
|
||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:packages/ci-log
|
version: link:packages/ci-log
|
||||||
|
@ -81,7 +81,7 @@ importers:
|
||||||
specifier: ^5.0.0
|
specifier: ^5.0.0
|
||||||
version: 5.0.0
|
version: 5.0.0
|
||||||
eslint:
|
eslint:
|
||||||
specifier: ^8.39.0
|
specifier: ^8.28.0
|
||||||
version: 8.39.0
|
version: 8.39.0
|
||||||
eslint-config-atomic:
|
eslint-config-atomic:
|
||||||
specifier: ^1.18.3
|
specifier: ^1.18.3
|
||||||
|
@ -1548,12 +1548,6 @@ packages:
|
||||||
fastq: 1.15.0
|
fastq: 1.15.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@npmcli/ci-detect@3.0.2:
|
|
||||||
resolution: {integrity: sha512-P7nZG0skRVa9lH0OQmFG62CrzOySUiuPbKopjVAj3sXP0m1om9XfIvTp46h+NvlpTyd121JekiXFZj+1pnbm9g==}
|
|
||||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
|
||||||
deprecated: this package has been deprecated, use `ci-info` instead
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@npmcli/fs@2.1.2:
|
/@npmcli/fs@2.1.2:
|
||||||
resolution: {integrity: sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==}
|
resolution: {integrity: sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==}
|
||||||
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
|
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
|
||||||
|
|
|
@ -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")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -9,7 +9,7 @@ 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"
|
||||||
|
@ -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")
|
||||||
|
|
|
@ -2,7 +2,7 @@ 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 execa from "execa"
|
||||||
import path, { addExeExt } from "patha"
|
import path, { addExeExt } from "patha"
|
||||||
import { chmodSync } from "fs"
|
import { chmodSync } from "fs"
|
||||||
|
@ -104,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
|
||||||
}
|
}
|
||||||
|
@ -112,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,7 +8,7 @@ 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"
|
||||||
|
@ -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)
|
||||||
|
|
|
@ -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,7 +3,7 @@ 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"
|
||||||
|
@ -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,7 +4,7 @@ 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"
|
||||||
|
@ -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"
|
||||||
|
@ -20,7 +20,7 @@ import execa 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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -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) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
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"
|
||||||
|
@ -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,7 +4,7 @@ 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"
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue