Skip to content

Commit 5397b1a

Browse files
authored
Merge pull request #37 from aminya/more-logging [skip ci]
2 parents 630f785 + 4b250a3 commit 5397b1a

File tree

14 files changed

+49
-24
lines changed

14 files changed

+49
-24
lines changed

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/chocolatey/chocolatey.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ export function setupChocolatey(
3939
}
4040

4141
// https://docs.chocolatey.org/en-us/choco/setup#install-with-cmd.exe
42-
execa.sync(powershell, [
43-
"-NoProfile",
44-
"-InputFormat",
45-
"None",
46-
"-ExecutionPolicy",
47-
"Bypass",
48-
"-Command",
49-
"[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))",
50-
])
42+
execa.sync(
43+
powershell,
44+
[
45+
"-NoProfile",
46+
"-InputFormat",
47+
"None",
48+
"-ExecutionPolicy",
49+
"Bypass",
50+
"-Command",
51+
"[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))",
52+
],
53+
{ stdio: "inherit" }
54+
)
5155

5256
const chocoPath = `${process.env.ALLUSERSPROFILE}\\chocolatey\\bin`
5357
addPath(chocoPath)

src/kcov/kcov.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function getKcovPackageInfo(version: string): PackageInfo {
3434
// await setupCmake("3.22.0", join(untildify(""), "cmake"), "")
3535
await setupAptPack("libdw-dev")
3636
await setupAptPack("libcurl4-openssl-dev")
37-
await execa("cmake", ["-S", "./", "-B", "./build"], { cwd: out })
38-
await execa("cmake", ["--build", "./build", "--config", "Release"], { cwd: out })
37+
await execa("cmake", ["-S", "./", "-B", "./build"], { cwd: out, stdio: "inherit" })
38+
await execa("cmake", ["--build", "./build", "--config", "Release"], { cwd: out, stdio: "inherit" })
3939
await execSudo("cmake", ["--install", "./build"], out)
4040
return out
4141
},

src/main.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { setupVCVarsall } from "./vcvarsall/vcvarsall"
3030
import { setupKcov } from "./kcov/kcov"
3131
import { addEnv } from "./utils/env/addEnv"
3232
import { setupSevenZip } from "./sevenzip/sevenzip"
33+
import { endGroup, startGroup } from "@actions/core"
3334

3435
/** The setup functions */
3536
const setups = {
@@ -125,22 +126,23 @@ export async function main(args: string[]): Promise<number> {
125126
// loop over the tools and run their setup function
126127
for (const tool of tools) {
127128
// get the version or "true" or undefined for this tool from the options
128-
const value = opts[tool]
129+
const version = opts[tool]
129130

130131
// skip if undefined
131-
if (value !== undefined) {
132+
if (version !== undefined) {
132133
// running the setup function for this tool
134+
startGroup(`Installing ${tool} ${version}`)
133135
try {
134136
let installationInfo: InstallationInfo | undefined | void
135137
if (tool === "vcvarsall") {
136138
// eslint-disable-next-line no-await-in-loop
137-
setupVCVarsall(getVersion(tool, value), undefined, arch, undefined, undefined, false, false)
139+
setupVCVarsall(getVersion(tool, version), undefined, arch, undefined, undefined, false, false)
138140
} else {
139141
// get the setup function
140142
const setupFunction = setups[tool]
141143

142144
// eslint-disable-next-line no-await-in-loop
143-
installationInfo = await setupFunction(getVersion(tool, value), join(setupCppDir, tool), arch)
145+
installationInfo = await setupFunction(getVersion(tool, version), join(setupCppDir, tool), arch)
144146
}
145147
// preparing a report string
146148
successMessages.push(getSuccessMessage(tool, installationInfo))
@@ -149,6 +151,7 @@ export async function main(args: string[]): Promise<number> {
149151
error(e as string | Error)
150152
errorMessages.push(`${tool} failed to install`)
151153
}
154+
endGroup()
152155
}
153156
}
154157

@@ -159,6 +162,7 @@ export async function main(args: string[]): Promise<number> {
159162
const { compiler, version } = getCompilerInfo(maybeCompiler)
160163

161164
// install the compiler. We allow some aliases for the compiler name
165+
startGroup(`Installing ${compiler} ${version ?? ""}`)
162166
switch (compiler) {
163167
case "llvm":
164168
case "clang":
@@ -198,10 +202,12 @@ export async function main(args: string[]): Promise<number> {
198202
errorMessages.push(`Unsupported compiler ${compiler}`)
199203
}
200204
}
205+
endGroup()
201206
}
202207
} catch (e) {
203208
error(e as string | Error)
204209
errorMessages.push(`Failed to install the ${maybeCompiler}`)
210+
endGroup()
205211
}
206212

207213
if (successMessages.length === 0 && errorMessages.length === 0) {

src/utils/exec/powershell.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export function execPowershell(command: string) {
1818
throw new Error("Could not find powershell")
1919
}
2020

21-
execa.sync(powershell, ["-c", command])
21+
execa.sync(powershell, ["-c", command], { stdio: "inherit" })
2222
}

src/utils/exec/sudo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export function execSudo(file: string, args: string[], cwd?: string) {
99
stdio: "inherit",
1010
})
1111
} else {
12-
return execa(file, args)
12+
return execa(file, args, { stdio: "inherit" })
1313
}
1414
}

src/utils/setup/extract.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export async function extractExe(file: string, dest: string) {
1616
sevenZip = "7z"
1717
}
1818

19-
await execa(sevenZip, ["x", file, `-o${dest}`])
19+
await execa(sevenZip, ["x", file, `-o${dest}`], { stdio: "inherit" })
2020
return dest
2121
}
2222

@@ -26,6 +26,6 @@ export async function extractTarByExe(file: string, dest: string, flags = ["--st
2626
} catch {
2727
// ignore
2828
}
29-
await execa("tar", ["xf", file, "-C", dest, ...flags])
29+
await execa("tar", ["xf", file, "-C", dest, ...flags], { stdio: "inherit" })
3030
return dest
3131
}

src/utils/setup/setupAptPack.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable require-atomic-updates */
22
import { InstallationInfo } from "./setupBin"
33
import { execSudo } from "../exec/sudo"
4+
import { info } from "@actions/core"
45

56
let didUpdate: boolean = false
67
let didInit: boolean = false
@@ -11,6 +12,8 @@ export async function setupAptPack(
1112
version?: string,
1213
repositories: boolean | string[] = true
1314
): Promise<InstallationInfo> {
15+
info(`Installing ${name} ${version ?? ""} via apt`)
16+
1417
const apt = "apt-get"
1518

1619
process.env.DEBIAN_FRONTEND = "noninteractive"

src/utils/setup/setupBin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export async function setupBin(
4545
setupDir: string,
4646
arch: string
4747
): Promise<InstallationInfo> {
48+
info(`Installing ${name} ${version} ${arch} via direct downloading`)
49+
4850
process.env.RUNNER_TEMP = process.env.RUNNER_TEMP ?? tmpdir()
4951
process.env.RUNNER_TOOL_CACHE = process.env.RUNNER_TOOL_CACHE ?? join(tmpdir(), "setup-cpp", "hostedtoolcache")
5052

@@ -64,6 +66,7 @@ export async function setupBin(
6466
if (existsSync(binDir) && existsSync(join(binDir, binFileName))) {
6567
info(`${name} ${version} was found in the cache at ${binDir}.`)
6668
addPath(binDir)
69+
6770
return { installDir, binDir }
6871
}
6972
}

0 commit comments

Comments
 (0)