feat: add opencppcoverage

This commit is contained in:
Amin Yahyaabadi 2021-09-16 03:49:25 -05:00
parent c8b9b73c4e
commit ea280dfd67
4 changed files with 37 additions and 0 deletions

View File

@ -42,6 +42,9 @@ inputs:
cppcheck: cppcheck:
description: "The cppcheck version to install." description: "The cppcheck version to install."
required: false required: false
opencppcoverage:
description: "The opencppcoverage version to install."
required: false
runs: runs:
using: "node12" using: "node12"

View File

@ -11,6 +11,7 @@ import { setupLLVM } from "./llvm/llvm"
import { setupMeson } from "./meson/meson" import { setupMeson } from "./meson/meson"
import { setupMSVC } from "./msvc/msvc" import { setupMSVC } from "./msvc/msvc"
import { setupNinja } from "./ninja/ninja" import { setupNinja } from "./ninja/ninja"
import { setupOpencppcoverage } from "./opencppcoverage/opencppcoverage"
import { setupPython } from "./python/python" import { setupPython } from "./python/python"
function maybeGetInput(key: string) { function maybeGetInput(key: string) {
@ -61,6 +62,12 @@ export async function main(): Promise<number> {
await setupGcovr(gcovrVersion) await setupGcovr(gcovrVersion)
} }
// setup opencppCoverage
const opencppCoverageVersion = maybeGetInput("opencppcoverage")
if (opencppCoverageVersion !== undefined) {
await setupOpencppcoverage(gcovrVersion)
}
// setup llvm // setup llvm
const llvmVersion = maybeGetInput("llvm") const llvmVersion = maybeGetInput("llvm")
if (llvmVersion !== undefined) { if (llvmVersion !== undefined) {

View File

@ -0,0 +1,17 @@
import { setupOpencppcoverage } from "../opencppcoverage"
import { spawnSync as spawn } from "child_process"
jest.setTimeout(200000)
describe("setup-OpenCppCoverage", () => {
it("should setup OpenCppCoverage", async () => {
if (process.platform !== "win32") {
return
}
await setupOpencppcoverage()
const { status } = spawn("OpenCppCoverage", ["--version"], {
encoding: "utf8",
})
expect(status).toBe(0)
})
})

View File

@ -0,0 +1,10 @@
import { addPath } from "@actions/core"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
export async function setupOpencppcoverage(version?: string) {
if (process.platform !== "win32") {
return
}
await setupChocoPack("opencppcoverage", version)
addPath("C:/Program Files/OpenCppCoverage")
}