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 llvm
- [x] setup conan - [x] setup conan
- [x] setup meson - [x] setup meson
- [x] setup gcovr
- [ ] setup msvc - [ ] setup msvc
- [ ] setup gcc/mingw - [ ] setup gcc/mingw
- [ ] setup vcpkg - [ ] setup vcpkg
- [ ] setup gcovr
- [ ] setup OpenCppCoverage - [ ] setup OpenCppCoverage
- [ ] setup cppcheck - [ ] setup cppcheck
- [ ] setup doxygen - [ ] setup doxygen

View File

@ -23,6 +23,9 @@ inputs:
meson: meson:
description: "The meson version to install." description: "The meson version to install."
required: false required: false
gcovr:
description: "The gcovr version to install."
required: false
runs: runs:
using: "node12" 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 * as core from "@actions/core"
import { setupCmake } from "./cmake/cmake" import { setupCmake } from "./cmake/cmake"
import { setupConan } from "./conan/conan" import { setupConan } from "./conan/conan"
import { setupGcovr } from "./gcovr/gcovr"
import { setupLLVM } from "./llvm/llvm" import { setupLLVM } from "./llvm/llvm"
import { setupMeson } from "./meson/meson" import { setupMeson } from "./meson/meson"
import { setupNinja } from "./ninja/ninja" import { setupNinja } from "./ninja/ninja"
@ -40,6 +41,12 @@ export async function main(): Promise<number> {
await setupMeson(mesonVersion) await setupMeson(mesonVersion)
} }
// setup gcovr
const gcovrVersion = maybeGetInput("gcovr")
if (gcovrVersion !== undefined) {
await setupGcovr(gcovrVersion)
}
// setup llvm // setup llvm
const llvmVersion = maybeGetInput("llvm") const llvmVersion = maybeGetInput("llvm")
if (llvmVersion !== undefined) { if (llvmVersion !== undefined) {