fix: fix isCI

This commit is contained in:
Amin Yahyaabadi 2021-09-18 08:27:06 -05:00
parent bfd6260fca
commit a0e33e0466
6 changed files with 12 additions and 10 deletions

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -15,6 +15,7 @@ import { setupOpencppcoverage } from "./opencppcoverage/opencppcoverage"
import { setupPython } from "./python/python" import { setupPython } from "./python/python"
import mri from "mri" import mri from "mri"
import untildify from "untildify" import untildify from "untildify"
import { isCI } from "./utils/env/isci"
import semverValid from "semver/functions/valid" import semverValid from "semver/functions/valid"
import { getVersion } from "./default_versions" import { getVersion } from "./default_versions"
@ -68,9 +69,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> {
const isCI = process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false" if (!isCI()) {
if (!isCI) {
process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true" process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS = "true"
} }

View File

@ -8,13 +8,14 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack" import { setupChocoPack } from "../utils/setup/setupChocoPack"
import hasha from "hasha" import hasha from "hasha"
import { join } from "path" import { join } from "path"
import { isCI } from "../utils/env/isci"
function isPyPyVersion(versionSpec: string) { function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith("pypy-") return versionSpec.startsWith("pypy-")
} }
export async function setupPython(version: string, setupCppDir: string, arch: string) { export async function setupPython(version: string, setupCppDir: string, arch: string) {
if (process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false") { if (!isCI()) {
return setupPythonViaSystem(version, setupCppDir, arch) return setupPythonViaSystem(version, setupCppDir, arch)
} }

3
src/utils/env/isci.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export function isCI() {
return !(process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false")
}

View File

@ -1,11 +1,10 @@
import * as core from "@actions/core" import * as core from "@actions/core"
import { isCI } from "../env/isci"
const isCI = process.env.CI === undefined || process.env.CI === "" || process.env.CI === "false"
export function error(err: string | Error) { export function error(err: string | Error) {
return isCI ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`) return isCI() ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`)
} }
export function success(msg: string) { export function success(msg: string) {
return isCI ? core.info(msg) : console.log(`\x1b[32m${msg}\x1b[0m`) return isCI() ? core.info(msg) : console.log(`\x1b[32m${msg}\x1b[0m`)
} }