mirror of
https://github.com/threeal/cmake-action.git
synced 2026-02-01 19:40:49 +00:00
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:
17
src/main.mts
17
src/main.mts
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user