Skip to content

Commit

Permalink
fix: add timeout for the LLVM installer call
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Aug 22, 2023
1 parent d7596dd commit 52047bd
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ inputs:
required: false
timeout:
description: "The timeout for installation of one tool (in minutes)."
default: "10"
default: "20"
required: false

runs:
Expand Down
6 changes: 3 additions & 3 deletions dist/actions/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/actions/setup-cpp.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/legacy/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/legacy/setup-cpp.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/modern/setup-cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/modern/setup-cpp.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/llvm/llvm_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupA
import { InstallationInfo } from "../utils/setup/setupBin"
import { promises } from "fs"
import { info } from "console"
import { DEFAULT_TIMEOUT } from "../tool"
const { readFile, writeFile, chmod } = promises

export async function setupLLVMApt(majorVersion: number): Promise<InstallationInfo> {
Expand All @@ -19,6 +20,7 @@ export async function setupLLVMApt(majorVersion: number): Promise<InstallationIn
await execRoot("bash", ["/tmp/llvm-setup-cpp.sh", `${majorVersion}`, "all"], {
stdio: "inherit",
shell: true,
timeout: DEFAULT_TIMEOUT,
})

await addPath(`${installationFolder}/bin`)
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function main(args: string[]): Promise<number> {
setupCppDir,
successMessages,
errorMessages,
parseFloat(opts.timeout ?? "10"),
parseFloat(opts.timeout ?? "20") * 60 * 1000,
)
time2 = Date.now()
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
Expand Down
4 changes: 3 additions & 1 deletion src/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ export type ToolName = keyof typeof setups
/** The tools that can be installed */
export const tools = Object.keys(setups) as Array<ToolName>

export const DEFAULT_TIMEOUT = 20 * 60 * 1000 // 20 minutes

export async function installTool(
tool: ToolName,
version: string,
Expand All @@ -77,7 +79,7 @@ export async function installTool(
setupCppDir: string,
successMessages: string[],
errorMessages: string[],
timeout: number = 0.1,
timeout: number = DEFAULT_TIMEOUT,
) {
startGroup(`Installing ${tool} ${version}`)
let hasLLVM = false
Expand Down

0 comments on commit 52047bd

Please sign in to comment.