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
|
- choco
|
||||||
- brew
|
- brew
|
||||||
- sevenzip
|
- sevenzip
|
||||||
|
- graphviz
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ inputs:
|
||||||
doxygen:
|
doxygen:
|
||||||
description: "The doxygen version to install."
|
description: "The doxygen version to install."
|
||||||
required: false
|
required: false
|
||||||
|
graphviz:
|
||||||
|
description: "The graphviz version to install."
|
||||||
|
required: false
|
||||||
cppcheck:
|
cppcheck:
|
||||||
description: "The cppcheck version to install."
|
description: "The cppcheck version to install."
|
||||||
required: false
|
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 { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
import { InstallationInfo } from "../../utils/setup/setupBin"
|
import { InstallationInfo } from "../../utils/setup/setupBin"
|
||||||
import { getVersion } from "../../default_versions"
|
import { getVersion } from "../../default_versions"
|
||||||
|
import which from "which"
|
||||||
|
|
||||||
jest.setTimeout(300000)
|
jest.setTimeout(300000)
|
||||||
describe("setup-doxygen", () => {
|
describe("setup-doxygen", () => {
|
||||||
|
@ -14,7 +15,8 @@ describe("setup-doxygen", () => {
|
||||||
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
|
const installInfo = await setupDoxygen(getVersion("doxygen", undefined), directory, process.arch)
|
||||||
|
|
||||||
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
await testBin("doxygen", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir)
|
||||||
await testBin("dot", ["-V"])
|
|
||||||
|
expect(which.sync("dot")).toBeDefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
|
|
@ -6,6 +6,8 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
|
||||||
import { addBinExtension } from "../utils/extension/extension"
|
import { addBinExtension } from "../utils/extension/extension"
|
||||||
import { extractTar } from "../utils/setup/extract"
|
import { extractTar } from "../utils/setup/extract"
|
||||||
import { warning } from "../utils/io/io"
|
import { warning } from "../utils/io/io"
|
||||||
|
import { setupGraphviz } from "../graphviz/graphviz"
|
||||||
|
import { getVersion } from "../default_versions"
|
||||||
|
|
||||||
/** Get the platform data for cmake */
|
/** Get the platform data for cmake */
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// 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) {
|
switch (process.platform) {
|
||||||
case "win32": {
|
case "win32": {
|
||||||
await setupChocoPack("doxygen.install", version)
|
await setupChocoPack("doxygen.install", version)
|
||||||
try {
|
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||||
await setupChocoPack("graphviz", undefined)
|
|
||||||
} catch (err) {
|
|
||||||
warning(`${err}`)
|
|
||||||
}
|
|
||||||
const binDir = activateWinDoxygen()
|
const binDir = activateWinDoxygen()
|
||||||
return { binDir }
|
return { binDir }
|
||||||
}
|
}
|
||||||
case "darwin": {
|
case "darwin": {
|
||||||
const installationInfo = setupBrewPack("doxygen", undefined)
|
const installationInfo = setupBrewPack("doxygen", undefined)
|
||||||
setupBrewPack("graphviz", undefined)
|
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||||
return installationInfo
|
return installationInfo
|
||||||
}
|
}
|
||||||
case "linux": {
|
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.`)
|
warning(`Failed to download doxygen binary. ${err}. Falling back to apt-get.`)
|
||||||
installationInfo = await setupAptPack("doxygen", undefined)
|
installationInfo = await setupAptPack("doxygen", undefined)
|
||||||
}
|
}
|
||||||
await setupAptPack("graphviz", undefined)
|
await setupGraphviz(getVersion("graphviz", undefined), "", arch)
|
||||||
return installationInfo
|
return installationInfo
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
@ -62,8 +60,14 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
|
||||||
}
|
}
|
||||||
|
|
||||||
function activateWinDoxygen() {
|
function activateWinDoxygen() {
|
||||||
addPath("C:/Program Files/Graphviz/bin")
|
switch (process.platform) {
|
||||||
|
case "win32": {
|
||||||
const binDir = "C:/Program Files/doxygen/bin"
|
const binDir = "C:/Program Files/doxygen/bin"
|
||||||
addPath(binDir)
|
addPath(binDir)
|
||||||
return 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 { addEnv } from "./utils/env/addEnv"
|
||||||
import { setupSevenZip } from "./sevenzip/sevenzip"
|
import { setupSevenZip } from "./sevenzip/sevenzip"
|
||||||
import { endGroup, startGroup } from "@actions/core"
|
import { endGroup, startGroup } from "@actions/core"
|
||||||
|
import { setupGraphviz } from "./graphviz/graphviz"
|
||||||
|
|
||||||
/** The setup functions */
|
/** The setup functions */
|
||||||
const setups = {
|
const setups = {
|
||||||
|
@ -48,6 +49,7 @@ const setups = {
|
||||||
brew: setupBrew,
|
brew: setupBrew,
|
||||||
ccache: setupCcache,
|
ccache: setupCcache,
|
||||||
doxygen: setupDoxygen,
|
doxygen: setupDoxygen,
|
||||||
|
graphviz: setupGraphviz,
|
||||||
cppcheck: setupCppcheck,
|
cppcheck: setupCppcheck,
|
||||||
clangtidy: setupClangTools,
|
clangtidy: setupClangTools,
|
||||||
clangformat: setupClangTools,
|
clangformat: setupClangTools,
|
||||||
|
@ -73,6 +75,7 @@ const tools: Array<keyof typeof setups> = [
|
||||||
"opencppcoverage",
|
"opencppcoverage",
|
||||||
"ccache",
|
"ccache",
|
||||||
"doxygen",
|
"doxygen",
|
||||||
|
"graphviz",
|
||||||
"cppcheck",
|
"cppcheck",
|
||||||
"clangtidy",
|
"clangtidy",
|
||||||
"clangformat",
|
"clangformat",
|
||||||
|
@ -304,6 +307,7 @@ All the available tools:
|
||||||
--choco
|
--choco
|
||||||
--brew
|
--brew
|
||||||
--sevenzip
|
--sevenzip
|
||||||
|
--graphviz
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue