mirror of https://github.com/aminya/setup-cpp
feat: make graphviz installation separate
This commit is contained in:
parent
c96659e9f2
commit
252db2e159
|
@ -40,6 +40,7 @@ The package can be used locally or from CI services like GitHub Actions.
|
|||
- choco
|
||||
- brew
|
||||
- sevenzip
|
||||
- graphviz
|
||||
|
||||
# Usage
|
||||
|
||||
|
|
|
@ -54,6 +54,9 @@ inputs:
|
|||
doxygen:
|
||||
description: "The doxygen version to install."
|
||||
required: false
|
||||
graphviz:
|
||||
description: "The graphviz version to install."
|
||||
required: false
|
||||
cppcheck:
|
||||
description: "The cppcheck version to install."
|
||||
required: false
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,7 @@ import { setupDoxygen } from "../doxygen"
|
|||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
||||
import { getVersion } from "../../default_versions"
|
||||
import which from "which"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-doxygen", () => {
|
||||
|
@ -14,7 +15,8 @@ describe("setup-doxygen", () => {
|
|||
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
|
||||
|
||||
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
await testBin("dot", ["-V"])
|
||||
|
||||
expect(which.sync("dot")).toBeDefined()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
|
|
|
@ -6,6 +6,8 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
|||
import { addBinExtension } from "../utils/extension/extension"
|
||||
import { extractTar } from "../utils/setup/extract"
|
||||
import { warning } from "../utils/io/io"
|
||||
import { setupGraphviz } from "../graphviz/graphviz"
|
||||
import { getVersion } from "../default_versions"
|
||||
|
||||
/** Get the platform data for cmake */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
@ -30,17 +32,13 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
|||
switch (process.platform) {
|
||||
case "win32": {
|
||||
await setupChocoPack("doxygen.install", version)
|
||||
try {
|
||||
await setupChocoPack("graphviz", undefined)
|
||||
} catch (err) {
|
||||
warning(`${err}`)
|
||||
}
|
||||
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||
const binDir = activateWinDoxygen()
|
||||
return { binDir }
|
||||
}
|
||||
case "darwin": {
|
||||
const installationInfo = setupBrewPack("doxygen", undefined)
|
||||
setupBrewPack("graphviz", undefined)
|
||||
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||
return installationInfo
|
||||
}
|
||||
case "linux": {
|
||||
|
@ -52,7 +50,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
|||
warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
|
||||
installationInfo = await setupAptPack("doxygen", undefined)
|
||||
}
|
||||
await setupAptPack("graphviz", undefined)
|
||||
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||
return installationInfo
|
||||
}
|
||||
default: {
|
||||
|
@ -62,8 +60,14 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
|||
}
|
||||
|
||||
function activateWinDoxygen() {
|
||||
addPath("C:/Program Files/Graphviz/bin")
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
const binDir = "C:/Program Files/doxygen/bin"
|
||||
addPath(binDir)
|
||||
return binDir
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unsupported platform`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import { setupGraphviz } from "../graphviz"
|
||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
||||
import { getVersion } from "../../default_versions"
|
||||
|
||||
jest.setTimeout(300000)
|
||||
describe("setup-graphviz", () => {
|
||||
let directory: string
|
||||
beforeAll(async () => {
|
||||
directory = await setupTmpDir("graphviz")
|
||||
})
|
||||
|
||||
it("should setup graphviz", async () => {
|
||||
const installInfo = await setupGraphviz(getVersion("graphviz", undefined), directory, process.arch)
|
||||
|
||||
await testBin("dot", ["-V"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanupTmpDir("graphviz")
|
||||
}, 100000)
|
||||
})
|
|
@ -0,0 +1,37 @@
|
|||
import { addPath } from "../utils/path/addPath"
|
||||
import { setupAptPack } from "../utils/setup/setupAptPack"
|
||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||
import { setupBrewPack } from "../utils/setup/setupBrewPack"
|
||||
import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export function setupGraphviz(version: string, _setupDir: string, _arch: string) {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
setupChocoPack("graphviz", version)
|
||||
return activateGraphviz()
|
||||
}
|
||||
case "darwin": {
|
||||
return setupBrewPack("graphviz", version)
|
||||
}
|
||||
case "linux": {
|
||||
return setupAptPack("graphviz", version)
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unsupported platform`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function activateGraphviz(): InstallationInfo {
|
||||
switch (process.platform) {
|
||||
case "win32": {
|
||||
const binDir = "C:/Program Files/Graphviz/bin"
|
||||
addPath(binDir)
|
||||
return { binDir }
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unsupported platform`)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ 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 */
|
||||
const setups = {
|
||||
|
@ -48,6 +49,7 @@ const setups = {
|
|||
brew: setupBrew,
|
||||
ccache: setupCcache,
|
||||
doxygen: setupDoxygen,
|
||||
graphviz: setupGraphviz,
|
||||
cppcheck: setupCppcheck,
|
||||
clangtidy: setupClangTools,
|
||||
clangformat: setupClangTools,
|
||||
|
@ -73,6 +75,7 @@ const tools: Array<keyof typeof setups> = [
|
|||
"opencppcoverage",
|
||||
"ccache",
|
||||
"doxygen",
|
||||
"graphviz",
|
||||
"cppcheck",
|
||||
"clangtidy",
|
||||
"clangformat",
|
||||
|
@ -304,6 +307,7 @@ All the available tools:
|
|||
--choco
|
||||
--brew
|
||||
--sevenzip
|
||||
--graphviz
|
||||
`)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue