mirror of https://github.com/aminya/setup-cpp.git
fix: allow partial options for setup tools
This commit is contained in:
parent
6f1d3cd81e
commit
26bd7cda45
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
|
|
@ -11,7 +11,7 @@ import { qualifiedNeededAptPackage } from "./qualify-install.js"
|
|||
|
||||
let binDir: string | undefined
|
||||
|
||||
export async function setupNala(version?: string) {
|
||||
export async function setupNala({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
if (!hasAptGet()) {
|
||||
return undefined
|
||||
}
|
||||
|
|
@ -94,3 +94,7 @@ export function bashWithNala(script: string) {
|
|||
}
|
||||
return script
|
||||
}
|
||||
function isUbuntu() {
|
||||
throw new Error("Function not implemented.")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
import { getInput } from "@actions/core"
|
||||
|
||||
/** Get an object from github actions */
|
||||
|
||||
export function maybeGetInput(key: string) {
|
||||
const value = getInput(key.toLowerCase())
|
||||
if (value !== "false" && value !== "") {
|
||||
return value
|
||||
}
|
||||
return undefined // skip installation
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ describe("setup-bazel", () => {
|
|||
return
|
||||
}
|
||||
it("should setup bazel", async () => {
|
||||
const installInfo = await setupBazel({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupBazel()
|
||||
|
||||
await testBin("bazel", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { isArch } from "../utils/env/isArch.js"
|
|||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
|
||||
export async function setupBazel({ version }: SetupOptions) {
|
||||
export async function setupBazel({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
// install bazelisk because it contains both
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { setupCcache } from "../ccache.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-ccache", () => {
|
||||
it("should setup ccache", async () => {
|
||||
const installInfo = await setupCcache({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupCcache()
|
||||
|
||||
await testBin("ccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupCcache({ version }: SetupOptions) {
|
||||
export async function setupCcache({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
return setupChocoPack("ccache", version)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-cmakelang", () => {
|
|||
it("should setup cmakelang", async () => {
|
||||
const installInfo = await setupCmakelang({
|
||||
version: getVersion("cmakelang", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
await testBin("cmake-lint", ["--version"], installInfo.binDir)
|
||||
await testBin("cmake-format", ["--version"], installInfo.binDir)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupCmakelang({ version }: SetupOptions) {
|
||||
export function setupCmakelang({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("cmakelang[YAML]", version)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ import semverValid from "semver/functions/valid"
|
|||
import { setupGcc } from "./gcc/gcc.js"
|
||||
import { setupMingw } from "./gcc/mingw.js"
|
||||
import { activateGcovGCC, activateGcovLLVM } from "./gcovr/gcovr.js"
|
||||
import { getSuccessMessage } from "./installTool.js"
|
||||
import { setupAppleClang } from "./llvm/apple-clang.js"
|
||||
import { setupLLVM } from "./llvm/llvm.js"
|
||||
import { setupMSVC } from "./msvc/msvc.js"
|
||||
import { getSuccessMessage } from "./options.js"
|
||||
import { appleClangSetups, gccSetups, llvmSetups, mingwSetups, msvcSetups } from "./tool.js"
|
||||
import type { InstallationInfo } from "./utils/setup/setupBin.js"
|
||||
import { getVersion } from "./versions/versions.js"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { setupConan } from "../conan.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-conan", () => {
|
||||
it("should setup conan", async () => {
|
||||
const installInfo = await setupConan({ version: getVersion("conan", "true"), setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupConan({ version: getVersion("conan", "true") })
|
||||
|
||||
await testBin("conan", ["--version"], installInfo.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupConan({ version }: SetupOptions) {
|
||||
export function setupConan({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("conan", version)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ describe("setup-cppcheck", () => {
|
|||
if (process.platform !== "win32") {
|
||||
const installInfo = await setupCppcheck({
|
||||
version: getVersion("cppcheck", undefined),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
|
||||
await testBin("cppcheck", ["--version"], installInfo.binDir)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupCppcheck({ version }: SetupOptions) {
|
||||
export async function setupCppcheck({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
await setupChocoPack("cppcheck", version)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-cpplint", () => {
|
|||
it("should setup cpplint", async () => {
|
||||
const installInfo = await setupCpplint({
|
||||
version: getVersion("cpplint", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
await testBin("cpplint", ["--version"], installInfo.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupCpplint({ version }: SetupOptions) {
|
||||
export function setupCpplint({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("cpplint", version, {
|
||||
pythonVersion: ">=3.8.0",
|
||||
})
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export async function setupDoxygen({ version, setupDir, arch }: SetupOptions) {
|
|||
)
|
||||
const binDir = await activateWinDoxygen()
|
||||
const installationInfo = { binDir }
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined), setupDir, arch })
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined) })
|
||||
return installationInfo
|
||||
}
|
||||
case "darwin": {
|
||||
|
|
@ -89,13 +89,13 @@ export async function setupDoxygen({ version, setupDir, arch }: SetupOptions) {
|
|||
|
||||
// only install graphviz if the macOS version is greater than 11
|
||||
if (macosVersion()[0] > 11) {
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined), setupDir, arch })
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined) })
|
||||
}
|
||||
return installationInfo
|
||||
}
|
||||
case "linux": {
|
||||
const installationInfo = await setupLinuxDoxygen({ version, setupDir, arch })
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined, await ubuntuVersion()), setupDir, arch })
|
||||
await setupGraphviz({ version: getVersion("graphviz", undefined, await ubuntuVersion()) })
|
||||
return installationInfo
|
||||
}
|
||||
default: {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-flawfinder", () => {
|
|||
it("should setup flawfinder", async () => {
|
||||
const installInfo = await setupFlawfinder({
|
||||
version: getVersion("flawfinder", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
await testBin("flawfinder", ["--version"], installInfo.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupFlawfinder({ version }: SetupOptions) {
|
||||
export function setupFlawfinder({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("flawfinder", version)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-gcovr", () => {
|
|||
it("should setup gcovr", async () => {
|
||||
const installInfo = await setupGcovr({
|
||||
version: getVersion("gcovr", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
await testBin("gcovr", ["--version"], installInfo.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { rcOptions } from "../options.js"
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupGcovr({ version }: SetupOptions) {
|
||||
export function setupGcovr({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
if (hasAptGet() && (version === undefined || version === "")) {
|
||||
// use apt on Ubuntu/Debian if version is not specified
|
||||
return installAptPack([{ name: "gcovr", version }])
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { setupGit } from "../git.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-git", () => {
|
||||
it("should setup git", async () => {
|
||||
const installInfo = await setupGit({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupGit()
|
||||
|
||||
await testBin("git", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupGit({ version }: SetupOptions) {
|
||||
export async function setupGit({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
const git = await which("git", { nothrow: true })
|
||||
if (git !== null) {
|
||||
info(`Git already installed at ${git}`)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { macosVersion } from "../../utils/env/macos_version.js"
|
||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version.js"
|
||||
import type { InstallationInfo } from "../../utils/setup/setupBin.js"
|
||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { cleanupTmpDir, testBin } from "../../utils/tests/test-helpers.js"
|
||||
import { getVersion } from "../../versions/versions.js"
|
||||
import { setupGraphviz } from "../graphviz.js"
|
||||
|
||||
|
|
@ -12,16 +12,9 @@ describe("setup-graphviz", () => {
|
|||
return
|
||||
}
|
||||
|
||||
let directory: string
|
||||
beforeAll(async () => {
|
||||
directory = await setupTmpDir("graphviz")
|
||||
})
|
||||
|
||||
it("should setup graphviz", async () => {
|
||||
const installInfo = await setupGraphviz({
|
||||
version: getVersion("graphviz", undefined, await ubuntuVersion()),
|
||||
setupDir: directory,
|
||||
arch: process.arch,
|
||||
})
|
||||
|
||||
await testBin("dot", ["-V"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupGraphviz({ version }: SetupOptions) {
|
||||
export async function setupGraphviz({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
await setupChocoPack("graphviz", version)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { join } from "path"
|
|||
import { endGroup, startGroup } from "@actions/core"
|
||||
import { error } from "ci-log"
|
||||
import { setupBrew } from "setup-brew"
|
||||
import { getSuccessMessage, rcOptions } from "./options.js"
|
||||
import { rcOptions } from "./options.js"
|
||||
import { type ToolName, llvmTools, setups } from "./tool.js"
|
||||
import type { InstallationInfo } from "./utils/setup/setupBin.js"
|
||||
import { setupVCVarsall } from "./vcvarsall/vcvarsall.js"
|
||||
|
|
@ -66,3 +66,17 @@ async function installToolImpl(
|
|||
// preparing a report string
|
||||
successMessages.push(getSuccessMessage(tool, installationInfo))
|
||||
}
|
||||
|
||||
export function getSuccessMessage(tool: string, installationInfo: InstallationInfo | undefined | void) {
|
||||
let msg = `✅ ${tool} was installed successfully:`
|
||||
if (installationInfo === undefined) {
|
||||
return msg
|
||||
}
|
||||
if ("installDir" in installationInfo) {
|
||||
msg += `\n- The installation directory is ${installationInfo.installDir}`
|
||||
}
|
||||
if (installationInfo.binDir !== "") {
|
||||
msg += `\n- The binary directory is ${installationInfo.binDir}`
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import { syncVersions } from "./versions/versions.js"
|
|||
// re-export for the setup-cpp CLI
|
||||
export { GITHUB_ACTIONS } from "ci-info"
|
||||
export * from "ci-log"
|
||||
export { maybeGetInput, type Opts } from "./options.js"
|
||||
export { type Inputs, inputs } from "./tool.js"
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-lizard", () => {
|
|||
it("should setup lizard", async () => {
|
||||
const installInfo = await setupLizard({
|
||||
version: getVersion("lizard", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
await testBin("lizard", ["--version"], installInfo.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupLizard({ version }: SetupOptions) {
|
||||
export function setupLizard({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("lizard", version)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ async function setupLLVMOnly(
|
|||
return apkInstallInfo
|
||||
}
|
||||
|
||||
const brewInstallInfo = await trySetupLLVMBrew({ version, setupDir, arch })
|
||||
const brewInstallInfo = await trySetupLLVMBrew({ version })
|
||||
if (brewInstallInfo !== undefined) {
|
||||
return brewInstallInfo
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,20 +5,20 @@ import { rcOptions } from "../options.ts"
|
|||
import type { SetupOptions } from "../setup-options.ts"
|
||||
import { majorLLVMVersion } from "./utils.ts"
|
||||
|
||||
export async function trySetupLLVMBrew({ version, setupDir, arch }: SetupOptions) {
|
||||
export async function trySetupLLVMBrew({ version }: Pick<SetupOptions, "version">) {
|
||||
if (process.platform !== "darwin") {
|
||||
return Promise.resolve(undefined)
|
||||
}
|
||||
|
||||
try {
|
||||
return await setupLLVMBrew({ version, setupDir, arch })
|
||||
return await setupLLVMBrew({ version })
|
||||
} catch (err) {
|
||||
info(`Failed to install llvm via brew: ${err}`)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export async function setupLLVMBrew({ version }: SetupOptions) {
|
||||
export async function setupLLVMBrew({ version }: Pick<SetupOptions, "version">) {
|
||||
const majorVersion = majorLLVMVersion(version)
|
||||
|
||||
// install llvm via brew if a bottle is available for it
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { setupMake } from "../make.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-make", () => {
|
||||
it("should setup make", async () => {
|
||||
const installInfo = await setupMake({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupMake()
|
||||
|
||||
await testBin("make", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupMake({ version }: SetupOptions) {
|
||||
export async function setupMake({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
return setupChocoPack("make", version)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ describe("setup-meson", () => {
|
|||
it("should setup meson", async () => {
|
||||
const installInfo = await setupMeson({
|
||||
version: getVersion("meson", "true", await ubuntuVersion()),
|
||||
setupDir: "",
|
||||
arch: process.arch,
|
||||
})
|
||||
|
||||
await testBin("meson", ["--version"], installInfo.binDir)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupPipPack } from "../utils/setup/setupPipPack.js"
|
||||
|
||||
export function setupMeson({ version }: SetupOptions) {
|
||||
export function setupMeson({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
return setupPipPack("meson", version)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ describe("setup-OpenCppCoverage", () => {
|
|||
return
|
||||
}
|
||||
it("should setup OpenCppCoverage", async () => {
|
||||
const installationInfo = await setupOpencppcoverage({ version: "", setupDir: "", arch: process.arch })
|
||||
const installationInfo = await setupOpencppcoverage()
|
||||
|
||||
await testBin("OpenCppCoverage", null, installationInfo?.binDir) // OpenCppCoverage exits with non-zero even with --help
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { rcOptions } from "../options.js"
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
|
||||
export async function setupOpencppcoverage({ version }: SetupOptions) {
|
||||
export async function setupOpencppcoverage({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
if (process.platform !== "win32") {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import { getInput } from "@actions/core"
|
||||
import type { AddPathOptions } from "envosman"
|
||||
import { untildifyUser } from "untildify-user"
|
||||
import type { Inputs } from "./tool.ts"
|
||||
import type { InstallationInfo } from "./utils/setup/setupBin.ts"
|
||||
|
||||
export const rcOptions: AddPathOptions = {
|
||||
rcPath: untildifyUser("~/.cpprc"),
|
||||
guard: "cpp",
|
||||
}
|
||||
|
||||
/**
|
||||
* The options for the setup-cpp function
|
||||
|
|
@ -12,31 +15,3 @@ export type Opts = Partial<Record<Inputs, string | undefined>> & {
|
|||
timeout?: string
|
||||
"node-package-manager"?: string
|
||||
}
|
||||
|
||||
/** Get an object from github actions */
|
||||
export function maybeGetInput(key: string) {
|
||||
const value = getInput(key.toLowerCase())
|
||||
if (value !== "false" && value !== "") {
|
||||
return value
|
||||
}
|
||||
return undefined // skip installation
|
||||
}
|
||||
|
||||
export function getSuccessMessage(tool: string, installationInfo: InstallationInfo | undefined | void) {
|
||||
let msg = `✅ ${tool} was installed successfully:`
|
||||
if (installationInfo === undefined) {
|
||||
return msg
|
||||
}
|
||||
if ("installDir" in installationInfo) {
|
||||
msg += `\n- The installation directory is ${installationInfo.installDir}`
|
||||
}
|
||||
if (installationInfo.binDir !== "") {
|
||||
msg += `\n- The binary directory is ${installationInfo.binDir}`
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
export const rcOptions: AddPathOptions = {
|
||||
rcPath: untildifyUser("~/.cpprc"),
|
||||
guard: "cpp",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,17 +63,17 @@ function getPowershellUrl(
|
|||
export async function setupPowershell({ version, setupDir, arch }: SetupOptions) {
|
||||
try {
|
||||
if (await hasApk()) {
|
||||
return setupPowershellSystem({ version, setupDir, arch })
|
||||
return setupPowershellSystem({ version })
|
||||
}
|
||||
|
||||
return await setupBin("pwsh", version, getPowerShellPackageInfo, setupDir, arch)
|
||||
} catch (err) {
|
||||
error(`Failed to setup pwsh via download: ${err}. Trying package managers...`)
|
||||
return setupPowershellSystem({ version, setupDir, arch })
|
||||
return setupPowershellSystem({ version })
|
||||
}
|
||||
}
|
||||
|
||||
export async function setupPowershellSystem({ version }: SetupOptions) {
|
||||
export async function setupPowershellSystem({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
await setupChocoPack("powershell-core", version)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe("setup-sccache", () => {
|
|||
return
|
||||
}
|
||||
|
||||
const installInfo = await setupSccache({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupSccache()
|
||||
|
||||
await testBin("sccache", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { getUbuntuVersion } from "ubuntu-version"
|
|||
import type { SetupOptions } from "../setup-options.js"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
||||
|
||||
export async function setupSccache({ version }: SetupOptions) {
|
||||
export async function setupSccache({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
return setupChocoPack("sccache", version)
|
||||
|
|
|
|||
|
|
@ -4,19 +4,9 @@
|
|||
import mri from "mri"
|
||||
import updateNotifier from "simple-update-notifier"
|
||||
import packageJson from "../package-version.json"
|
||||
import {
|
||||
GITHUB_ACTIONS,
|
||||
type Inputs,
|
||||
type Opts,
|
||||
error,
|
||||
info,
|
||||
inputs,
|
||||
maybeGetInput,
|
||||
setupCpp,
|
||||
success,
|
||||
warning,
|
||||
} from "./lib.ts"
|
||||
|
||||
import { maybeGetInput } from "./actions-input.js"
|
||||
import { GITHUB_ACTIONS, type Inputs, error, info, inputs, setupCpp, success, warning } from "./lib.ts"
|
||||
import type { Opts } from "./options.js"
|
||||
/** The main entry function */
|
||||
async function main(args: string[]): Promise<number> {
|
||||
const checkUpdatePromise = GITHUB_ACTIONS ? Promise.resolve() : checkUpdates()
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { setupSevenZip } from "../sevenzip.js"
|
|||
jest.setTimeout(300000)
|
||||
describe("setup-7z", () => {
|
||||
it("should setup 7z", async () => {
|
||||
const installInfo = await setupSevenZip({ version: "", setupDir: "", arch: process.arch })
|
||||
const installInfo = await setupSevenZip()
|
||||
|
||||
await testBin("7z", ["--help"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
|
|||
import { setupDnfPack } from "../utils/setup/setupDnfPack.js"
|
||||
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
|
||||
|
||||
export async function setupSevenZip({ version }: SetupOptions) {
|
||||
export async function setupSevenZip({ version }: Partial<Pick<SetupOptions, "version">> = {}) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
return setupChocoPack("7zip", version)
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export const setups = {
|
|||
tar: setupTar,
|
||||
} as const satisfies
|
||||
| Record<string, () => Promise<InstallationInfo | undefined>>
|
||||
| Record<string, (opts: Partial<SetupOptions>) => Promise<InstallationInfo | undefined>>
|
||||
| Record<string, (opts: SetupOptions) => Promise<InstallationInfo | undefined>>
|
||||
| Record<"vcvarsall", (opts: SetupVCVarsallOptions) => Promise<void>>
|
||||
| Record<"msvc", (opts: SetupMSVCOptions) => Promise<void>>
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ async function run7zip(file: string, dest: string) {
|
|||
async function getSevenZip() {
|
||||
if (sevenZip === undefined) {
|
||||
if (which.sync("7z", { nothrow: true }) === null) {
|
||||
await setupSevenZip({ version: "", setupDir: "", arch: process.arch })
|
||||
await setupSevenZip({ version: "" })
|
||||
}
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
sevenZip = "7z"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import { addPath } from "envosman"
|
|||
import { chmod } from "fs/promises"
|
||||
import { pathExists } from "path-exists"
|
||||
import retry from "retry-as-promised"
|
||||
import { maybeGetInput, rcOptions } from "../../options.js"
|
||||
import { maybeGetInput } from "../../actions-input.js"
|
||||
import { rcOptions } from "../../options.js"
|
||||
import { getArchiveType, getExtractFunction } from "./extract.js"
|
||||
|
||||
/** A type that describes a package */
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export async function setupVcpkg({ version, setupDir, arch }: SetupOptions): Pro
|
|||
}
|
||||
|
||||
// vcpkg dependencies
|
||||
await setupGit({ version: "", setupDir, arch })
|
||||
await setupGit()
|
||||
|
||||
if (process.platform === "linux") {
|
||||
if (isArch()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue