feat: add gcovr installation

This commit is contained in:
Amin Yahyaabadi 2021-09-14 12:42:08 -05:00
parent 1ffc145596
commit 9d9f62c579
5 changed files with 41 additions and 1 deletions

View File

@ -18,10 +18,10 @@ The package will be usable from any environment (locally, GitHub Actions, etc).
- [x] setup llvm
- [x] setup conan
- [x] setup meson
- [x] setup gcovr
- [ ] setup msvc
- [ ] setup gcc/mingw
- [ ] setup vcpkg
- [ ] setup gcovr
- [ ] setup OpenCppCoverage
- [ ] setup cppcheck
- [ ] setup doxygen

View File

@ -23,6 +23,9 @@ inputs:
meson:
description: "The meson version to install."
required: false
gcovr:
description: "The gcovr version to install."
required: false
runs:
using: "node12"

View File

@ -0,0 +1,15 @@
import { setupGcovr } from "../gcovr"
import { spawnSync as spawn } from "child_process"
jest.setTimeout(100000)
describe("setup-gcovr", () => {
it("should setup gcovr", async () => {
await setupGcovr("5.0")
const { status } = spawn("gcovr", ["--version"], {
encoding: "utf8",
})
expect(status).toBe(0)
})
})

15
src/gcovr/gcovr.ts Normal file
View File

@ -0,0 +1,15 @@
import { setupPip } from "../utils/setup/setupPip"
import { addPath, startGroup, endGroup } from "@actions/core"
export async function setupGcovr(version?: string) {
await setupPip("gcovr", version)
if (process.platform === "linux") {
try {
startGroup(`Add /home/runner/.local/bin to PATH`)
addPath("/home/runner/.local/bin/")
} finally {
endGroup()
}
}
}

View File

@ -1,6 +1,7 @@
import * as core from "@actions/core"
import { setupCmake } from "./cmake/cmake"
import { setupConan } from "./conan/conan"
import { setupGcovr } from "./gcovr/gcovr"
import { setupLLVM } from "./llvm/llvm"
import { setupMeson } from "./meson/meson"
import { setupNinja } from "./ninja/ninja"
@ -40,6 +41,12 @@ export async function main(): Promise<number> {
await setupMeson(mesonVersion)
}
// setup gcovr
const gcovrVersion = maybeGetInput("gcovr")
if (gcovrVersion !== undefined) {
await setupGcovr(gcovrVersion)
}
// setup llvm
const llvmVersion = maybeGetInput("llvm")
if (llvmVersion !== undefined) {