mirror of https://github.com/aminya/setup-cpp
fix: do not create nested logging groups
This commit is contained in:
parent
936a9677f7
commit
e6efc4aca9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import { execSudo } from "../exec/sudo"
|
||||
import { endGroup, startGroup } from "@actions/core"
|
||||
import { info } from "@actions/core"
|
||||
|
||||
let didUpdate: boolean = false
|
||||
let didInit: boolean = false
|
||||
|
@ -12,7 +12,7 @@ export async function setupAptPack(
|
|||
version?: string,
|
||||
repositories: boolean | string[] = true
|
||||
): Promise<InstallationInfo> {
|
||||
startGroup(`Installing ${name} ${version ?? ""} via apt`)
|
||||
info(`Installing ${name} ${version ?? ""} via apt`)
|
||||
|
||||
const apt = "apt-get"
|
||||
|
||||
|
@ -58,6 +58,5 @@ export async function setupAptPack(
|
|||
await execSudo(apt, ["install", "--fix-broken", "-y", name])
|
||||
}
|
||||
|
||||
endGroup()
|
||||
return { binDir: "/usr/bin/" }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
|
||||
import { endGroup, info, startGroup } from "@actions/core"
|
||||
import { info } from "@actions/core"
|
||||
import { addPath } from "../path/addPath"
|
||||
import { join } from "path"
|
||||
import { existsSync } from "fs"
|
||||
|
@ -45,7 +45,7 @@ export async function setupBin(
|
|||
setupDir: string,
|
||||
arch: string
|
||||
): Promise<InstallationInfo> {
|
||||
startGroup(`Installing ${name} ${version} ${arch} via direct downloading`)
|
||||
info(`Installing ${name} ${version} ${arch} via direct downloading`)
|
||||
|
||||
process.env.RUNNER_TEMP = process.env.RUNNER_TEMP ?? tmpdir()
|
||||
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACHE ?? join(tmpdir(), "setup-cpp", "hostedtoolcache")
|
||||
|
@ -67,7 +67,6 @@ export async function setupBin(
|
|||
info(`${name} ${version} was found in the cache at ${binDir}.`)
|
||||
addPath(binDir)
|
||||
|
||||
endGroup()
|
||||
return { installDir, binDir }
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +94,6 @@ export async function setupBin(
|
|||
const downloaded = await downloadTool(url)
|
||||
await extractFunction?.(downloaded, setupDir)
|
||||
} catch (err) {
|
||||
endGroup()
|
||||
throw new Error(`Failed to download ${name} ${version} ${arch}: ${err}`)
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +108,5 @@ export async function setupBin(
|
|||
await cacheDir(setupDir, name, version)
|
||||
}
|
||||
|
||||
endGroup()
|
||||
return { installDir, binDir }
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable require-atomic-updates */
|
||||
import { endGroup, startGroup } from "@actions/core"
|
||||
import { info } from "@actions/core"
|
||||
import execa from "execa"
|
||||
import which from "which"
|
||||
import { setupBrew } from "../../brew/brew"
|
||||
|
@ -9,7 +9,7 @@ let hasBrew = false
|
|||
|
||||
/** A function that installs a package using brew */
|
||||
export function setupBrewPack(name: string, version?: string): InstallationInfo {
|
||||
startGroup(`Installing ${name} ${version ?? ""} via brew`)
|
||||
info(`Installing ${name} ${version ?? ""} via brew`)
|
||||
|
||||
if (!hasBrew || which.sync("brew", { nothrow: true }) === null) {
|
||||
setupBrew("", "", process.arch)
|
||||
|
@ -21,6 +21,5 @@ export function setupBrewPack(name: string, version?: string): InstallationInfo
|
|||
stdio: "inherit",
|
||||
})
|
||||
|
||||
endGroup()
|
||||
return { binDir: "/usr/local/bin/" }
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@ import which from "which"
|
|||
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||
import { InstallationInfo } from "./setupBin"
|
||||
import execa from "execa"
|
||||
import { endGroup, startGroup } from "@actions/core"
|
||||
import { info } from "@actions/core"
|
||||
|
||||
let hasChoco = false
|
||||
|
||||
/** A function that installs a package using choco */
|
||||
export function setupChocoPack(name: string, version?: string, args: string[] = []): InstallationInfo {
|
||||
startGroup(`Installing ${name} ${version ?? ""} via chocolatey`)
|
||||
info(`Installing ${name} ${version ?? ""} via chocolatey`)
|
||||
|
||||
if (!hasChoco || which.sync("choco", { nothrow: true }) === null) {
|
||||
setupChocolatey("", "", process.arch)
|
||||
|
@ -38,6 +38,5 @@ export function setupChocoPack(name: string, version?: string, args: string[] =
|
|||
const binDir = `${process.env.ChocolateyInstall ?? "C:/ProgramData/chocolatey"}/bin`
|
||||
addPath(binDir)
|
||||
|
||||
endGroup()
|
||||
return { binDir }
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { getExecOutput } from "@actions/exec"
|
||||
import execa from "execa"
|
||||
import which from "which"
|
||||
import { endGroup, info, startGroup } from "@actions/core"
|
||||
import { info } from "@actions/core"
|
||||
import { addPath } from "../path/addPath"
|
||||
import { setupPython } from "../../python/python"
|
||||
import { isBinUptoDate } from "./version"
|
||||
|
@ -17,7 +17,7 @@ let tried = false
|
|||
|
||||
/** A function that installs a package using pip */
|
||||
export async function setupPipPack(name: string, version?: string): Promise<InstallationInfo> {
|
||||
startGroup(`Installing ${name} ${version ?? ""} via pip`)
|
||||
info(`Installing ${name} ${version ?? ""} via pip`)
|
||||
|
||||
// setup python and pip if needed
|
||||
if (python === undefined) {
|
||||
|
@ -30,11 +30,9 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
|||
await setupPython(getVersion("python", undefined), "", process.arch)
|
||||
// try again
|
||||
if (tried) {
|
||||
endGroup()
|
||||
throw new Error("Failed to install python")
|
||||
}
|
||||
tried = true
|
||||
endGroup()
|
||||
return setupPipPack(name, version)
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +68,5 @@ export async function setupPipPack(name: string, version?: string): Promise<Inst
|
|||
addPath(binDir)
|
||||
}
|
||||
|
||||
endGroup()
|
||||
return { binDir }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue