From e57f0f2848e9c6f82181b6a7cc3b1bcd78f3b952 Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 20 Nov 2023 20:58:09 +0700 Subject: [PATCH] feat: run CTest if `run-test` is true --- main/index.mjs | 12 ++++++++++++ src/main.mts | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/main/index.mjs b/main/index.mjs index 4c55e97..1d6d60e 100644 --- a/main/index.mjs +++ b/main/index.mjs @@ -27251,6 +27251,18 @@ async function main() { .flatMap((args) => args.split(" ")); await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", ["--build", buildDir || "build", ...buildArgs]); } + const runTest = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-test"); + 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(); //# sourceMappingURL=main.mjs.map diff --git a/src/main.mts b/src/main.mts index cfcf499..b2e21de 100644 --- a/src/main.mts +++ b/src/main.mts @@ -14,6 +14,20 @@ async function main() { .flatMap((args) => args.split(" ")); await exec.exec("cmake", ["--build", buildDir || "build", ...buildArgs]); } + + const runTest = core.getBooleanInput("run-test"); + 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();