diff --git a/README.md b/README.md index 0d22b180..19a48775 100644 --- a/README.md +++ b/README.md @@ -26,5 +26,4 @@ The package will be usable from any environment (locally, GitHub Actions, etc). - [x] setup ccache - [ ] setup gcc/mingw - [ ] setup OpenCppCoverage -- [ ] setup doxygen - [ ] setup vcpkg diff --git a/action.yml b/action.yml index 22ddc3d0..f5f375ff 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,12 @@ inputs: ccache: description: "The ccache version to install." required: false + doxygen: + description: "The doxygen version to install." + required: false + cppcheck: + description: "The cppcheck version to install." + required: false runs: using: "node12" diff --git a/src/doxygen/__tests__/doxygen.test.ts b/src/doxygen/__tests__/doxygen.test.ts new file mode 100644 index 00000000..ecc6dd7a --- /dev/null +++ b/src/doxygen/__tests__/doxygen.test.ts @@ -0,0 +1,14 @@ +import { setupDoxygen } from "../doxygen" +import { spawnSync as spawn } from "child_process" + +jest.setTimeout(200000) +describe("setup-doxygen", () => { + it("should setup doxygen", async () => { + await setupDoxygen() + + const { status } = spawn("doxygen", ["--version"], { + encoding: "utf8", + }) + expect(status).toBe(0) + }) +}) diff --git a/src/doxygen/doxygen.ts b/src/doxygen/doxygen.ts new file mode 100644 index 00000000..87de8087 --- /dev/null +++ b/src/doxygen/doxygen.ts @@ -0,0 +1,23 @@ +import { setupAptPack } from "../utils/setup/setupAptPack" +import { setupBrewPack } from "../utils/setup/setupBrewPack" +import { setupChocoPack } from "../utils/setup/setupChocoPack" + +export async function setupDoxygen(version?: string) { + switch (process.platform) { + case "win32": { + await setupChocoPack("graphviz", version) + return setupChocoPack("doxygen.install", version) + } + case "darwin": { + await setupBrewPack("graphviz", version) + return setupBrewPack("doxygen", version) + } + case "linux": { + await setupAptPack("graphviz", version) + return setupAptPack("doxygen", version) + } + default: { + throw new Error(`Unsupported platform`) + } + } +} diff --git a/src/main.ts b/src/main.ts index 5a7de6d5..ba54dfd7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,8 @@ import { setupCcache } from "./ccache/ccache" import { setupChocolatey } from "./chocolatey/chocolatey" import { setupCmake } from "./cmake/cmake" import { setupConan } from "./conan/conan" +import { setupCppcheck } from "./cppcheck/cppcheck" +import { setupDoxygen } from "./doxygen/doxygen" import { setupGcovr } from "./gcovr/gcovr" import { setupLLVM } from "./llvm/llvm" import { setupMeson } from "./meson/meson" @@ -83,6 +85,18 @@ export async function main(): Promise { await setupCcache(ccacheVersion) } + // setup doxygen + const doxygenVersion = maybeGetInput("doxygen") + if (doxygenVersion !== undefined) { + await setupDoxygen(doxygenVersion) + } + + // setup cppCheck + const cppCheckVersion = maybeGetInput("cppcheck") + if (cppCheckVersion !== undefined) { + await setupCppcheck(cppCheckVersion) + } + // setup msvc const msvcVersion = maybeGetInput("msvc") if (msvcVersion !== undefined) {