fix: use utils/io instead of `@actions/core`

This commit is contained in:
Amin Yahyaabadi 2022-05-02 21:44:28 -07:00
parent 5b1c9b8d45
commit 682ca30420
6 changed files with 14 additions and 18 deletions

View File

@ -7,9 +7,8 @@ import semverMajor from "semver/functions/major"
import semverCoerce from "semver/functions/coerce"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import path from "path"
import { warning } from "../utils/io/io"
import { warning, info } from "../utils/io/io"
import { isGitHubCI } from "../utils/env/isci"
import { info } from "@actions/core"
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function setupGcc(version: string, _setupDir: string, arch: string) {

View File

@ -8,9 +8,9 @@ import { getSpecificVersionAndUrl, getVersions, semverCoerceIfInvalid } from "..
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addBinExtension } from "../utils/extension/extension"
import { addEnv } from "../utils/env/addEnv"
import { info, setOutput } from "@actions/core"
import { setOutput } from "@actions/core"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { warning } from "../utils/io/io"
import { info, warning } from "../utils/io/io"
import { existsSync } from "fs"
import { isGitHubCI } from "../utils/env/isci"
import { setupGcc } from "../gcc/gcc"

View File

@ -1,4 +1,4 @@
import * as core from "@actions/core"
import { getInput, endGroup, startGroup } from "@actions/core"
import { setupBrew } from "./brew/brew"
import { setupCcache } from "./ccache/ccache"
import { setupMake } from "./make/make"
@ -40,7 +40,6 @@ import { setupVCVarsall } from "./vcvarsall/vcvarsall"
import { setupKcov } from "./kcov/kcov"
import { addEnv } from "./utils/env/addEnv"
import { setupSevenZip } from "./sevenzip/sevenzip"
import { endGroup, startGroup } from "@actions/core"
import { setupGraphviz } from "./graphviz/graphviz"
/** The setup functions */
@ -218,7 +217,7 @@ export async function main(args: string[]): Promise<number> {
}
case "appleclang":
case "applellvm": {
core.info("Assuming apple-clang is already installed")
info("Assuming apple-clang is already installed")
addEnv("CC", "clang")
addEnv("CXX", "clang++")
successMessages.push(getSuccessMessage("apple-clang", undefined))
@ -249,7 +248,7 @@ export async function main(args: string[]): Promise<number> {
successMessages.forEach((tool) => success(tool))
errorMessages.forEach((tool) => error(tool))
core.info("setup_cpp finished")
info("setup_cpp finished")
if (!isGitHubCI()) {
switch (process.platform) {
@ -290,7 +289,7 @@ export function getCompilerInfo(maybeCompiler: string) {
if (semverValid(maybeVersion) !== null) {
return { compiler, version: maybeVersion }
} else {
core.info(`Invalid semver version ${maybeVersion} used for the compiler.`)
info(`Invalid semver version ${maybeVersion} used for the compiler.`)
return { compiler, version: maybeVersion }
}
}
@ -298,7 +297,7 @@ export function getCompilerInfo(maybeCompiler: string) {
}
function printHelp() {
core.info(`
info(`
setup_cpp [options]
setup_cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
@ -340,7 +339,7 @@ All the available tools:
/** Get an object from github actions */
function maybeGetInput(key: string) {
const value = core.getInput(key.toLowerCase())
const value = getInput(key.toLowerCase())
if (value !== "false" && value !== "") {
return value
}

View File

@ -1,5 +1,4 @@
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { info } from "@actions/core"
import { setupVCVarsall } from "../vcvarsall/vcvarsall"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
@ -7,7 +6,7 @@ import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
import { isGitHubCI } from "../utils/env/isci"
import path from "path"
import { existsSync } from "fs"
import { error, warning } from "../utils/io/io"
import { error, info, warning } from "../utils/io/io"
type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string

View File

@ -1,10 +1,9 @@
import * as core from "@actions/core"
import { addPath } from "../utils/env/addEnv"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { isGitHubCI } from "../utils/env/isci"
import { warning } from "@actions/core"
import { warning, info } from "../utils/io/io"
export async function setupPython(version: string, setupDir: string, arch: string) {
if (!isGitHubCI()) {
@ -15,7 +14,7 @@ export async function setupPython(version: string, setupDir: string, arch: strin
const { setupActionsPython } = await import("./actions_python")
return setupActionsPython(version, setupDir, arch)
} catch (err) {
warning(err as Error)
warning((err as Error).toString())
return setupPythonViaSystem(version, setupDir, arch)
}
}
@ -50,6 +49,6 @@ export function setupPythonViaSystem(version: string, setupDir: string, _arch: s
}
function activateWinPython(binDir: string) {
core.info(`Add ${binDir} to PATH`)
info(`Add ${binDir} to PATH`)
addPath(binDir)
}

View File

@ -1,9 +1,9 @@
import { info } from "@actions/core"
import { existsSync } from "fs"
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
import { addEnv } from "../utils/env/addEnv"
import { info } from "../utils/io/io"
function getArch(arch: string): string {
switch (arch) {