mirror of
https://github.com/threeal/cmake-action.git
synced 2025-04-20 18:51:19 +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:
parent
421f12e1db
commit
1829bd6347
14
main/index.mjs
generated
14
main/index.mjs
generated
@ -27246,11 +27246,23 @@ async function main() {
|
|||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", [sourceDir || ".", "-B", buildDir || "build"]);
|
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", [sourceDir || ".", "-B", buildDir || "build"]);
|
||||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("build-dir", buildDir || "build");
|
_actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("build-dir", buildDir || "build");
|
||||||
const runBuild = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-build");
|
const runBuild = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-build");
|
||||||
if (runBuild) {
|
const runTest = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-test");
|
||||||
|
if (runBuild || runTest) {
|
||||||
const buildArgs = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("build-args")
|
const buildArgs = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("build-args")
|
||||||
.flatMap((args) => args.split(" "));
|
.flatMap((args) => args.split(" "));
|
||||||
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
|
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
|
||||||
}
|
}
|
||||||
|
if (runTest) {
|
||||||
|
const testArgs = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("test-args")
|
||||||
|
.flatMap((args) => args.split(" "));
|
||||||
|
await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("ctest", [
|
||||||
|
"--test-dir",
|
||||||
|
buildDir || "build",
|
||||||
|
"--output-on-failure",
|
||||||
|
"--no-tests=error",
|
||||||
|
...testArgs,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
main();
|
main();
|
||||||
//# sourceMappingURL=main.mjs.map
|
//# sourceMappingURL=main.mjs.map
|
||||||
|
17
src/main.mts
17
src/main.mts
@ -8,12 +8,27 @@ async function main() {
|
|||||||
core.setOutput("build-dir", buildDir || "build");
|
core.setOutput("build-dir", buildDir || "build");
|
||||||
|
|
||||||
const runBuild = core.getBooleanInput("run-build");
|
const runBuild = core.getBooleanInput("run-build");
|
||||||
if (runBuild) {
|
const runTest = core.getBooleanInput("run-test");
|
||||||
|
|
||||||
|
if (runBuild || runTest) {
|
||||||
const buildArgs = core
|
const buildArgs = core
|
||||||
.getMultilineInput("build-args")
|
.getMultilineInput("build-args")
|
||||||
.flatMap((args) => args.split(" "));
|
.flatMap((args) => args.split(" "));
|
||||||
await exec.exec("cmake", ["--build", buildDir || "build", ...buildArgs]);
|
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();
|
main();
|
||||||
|
Loading…
Reference in New Issue
Block a user