feat: run CTest from the JavaScript Action (#77)

* feat: run CTest if `run-test` is true

* feat: run CMake build if `run-test` set to true
This commit is contained in:
Alfi Maulana
2023-11-20 21:19:04 +07:00
committed by GitHub
parent 421f12e1db
commit 1829bd6347
2 changed files with 29 additions and 2 deletions

View File

@@ -8,12 +8,27 @@ async function main() {
core.setOutput("build-dir", buildDir || "build");
const runBuild = core.getBooleanInput("run-build");
if (runBuild) {
const runTest = core.getBooleanInput("run-test");
if (runBuild || runTest) {
const buildArgs = core
.getMultilineInput("build-args")
.flatMap((args) => args.split(" "));
await exec.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
}
if (runTest) {
const testArgs = core
.getMultilineInput("test-args")
.flatMap((args) => args.split(" "));
await exec.exec("ctest", [
"--test-dir",
buildDir || "build",
"--output-on-failure",
"--no-tests=error",
...testArgs,
]);
}
}
main();