feat: fail fast inside CI when an error happens

This commit is contained in:
Amin Yahyaabadi 2023-08-21 20:16:33 -07:00
parent d93dc2b536
commit d7596dd449
7 changed files with 30 additions and 18 deletions

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
/* eslint-disable node/shebang */
import { GITHUB_ACTIONS } from "ci-info"
import { GITHUB_ACTIONS, isCI } from "ci-info"
import { error, info, success, warning } from "ci-log"
import * as numerous from "numerous"
import numerousLocale from "numerous/locales/en.js"
@ -69,7 +69,17 @@ async function main(args: string[]): Promise<number> {
let hasLLVM = false
// loop over the tools and run their setup function
let failedFast = false
for (const tool of tools) {
// fail fast inside CI when any tool fails
if (isCI) {
if (errorMessages.length !== 0) {
failedFast = true
break
}
}
// get the version or "true" or undefined for this tool from the options
const version = opts[tool]
@ -86,13 +96,14 @@ async function main(args: string[]): Promise<number> {
setupCppDir,
successMessages,
errorMessages,
parseFloat(opts.timeout ?? "0.1"),
parseFloat(opts.timeout ?? "10"),
)
time2 = Date.now()
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
}
}
if (!failedFast) {
// installing the specified compiler
const maybeCompiler = opts.compiler
if (maybeCompiler !== undefined) {
@ -101,6 +112,7 @@ async function main(args: string[]): Promise<number> {
const time2Compiler = Date.now()
info(`took ${timeFormatter.format(time1Compiler, time2Compiler) || "0 seconds"}`)
}
}
await finalizeCpprc()