diff --git a/README.md b/README.md index de7e8f0..7ca4d9b 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ For more information, refer to [action.yml](./action.yml) and the [GitHub Action | `source-dir` | Path | Source directory of the CMake project. Defaults to the current directory. | | `build-dir` | Path | Build directory of the CMake project. Defaults to the `build` directory inside the source directory. | | `targets` | Multiple strings | List of build targets. | -| `run-test` | `true` or `false` | If enabled, runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. | | `generator` | String | Build system generator for the CMake project. | | `c-compiler` | String | Preferred executable for compiling C language files. | | `cxx-compiler` | String | Preferred executable for compiling C++ language files. | | `c-flags` | Multiple strings | Additional flags passed when compiling C language files. | | `cxx-flags` | Multiple strings | Additional flags passed when compiling C++ language files. | | `args` | Multiple strings | Additional arguments passed during CMake configuration. | +| `run-test` | `true` or `false` | If enabled, runs testing using [CTest](https://cmake.org/cmake/help/latest/manual/ctest.1.html). Defaults to `false`. | | `test-args` | Multiple strings | Additional arguments passed during the CTest run. | > Note: Multiple strings mean that the input can be specified with more than one value. Separate each value with a space or a new line. diff --git a/action.yml b/action.yml index ec6c6aa..9539e40 100644 --- a/action.yml +++ b/action.yml @@ -14,10 +14,6 @@ inputs: targets: description: List of build targets required: false - run-test: - description: If enabled, run testing using CTest (true/false) - required: false - default: false generator: description: Build system generator of the CMake project required: false @@ -36,6 +32,10 @@ inputs: args: description: Additional arguments passed during the CMake configuration required: false + run-test: + description: If enabled, run testing using CTest (true/false) + required: false + default: false test-args: description: Additional arguments passed during the CTest run required: false @@ -62,9 +62,6 @@ runs: if [ -n '${{ inputs.targets }}' ]; then BUILD_ARGS="$BUILD_ARGS --target ${{ inputs.targets }}" fi - if [ '${{ inputs.run-test }}' == 'true' ]; then - TEST_ARGS="--test-dir '$BUILD_DIR' --output-on-failure --no-tests=error" - fi if [ -n '${{ inputs.generator }}' ]; then ARGS="$ARGS -G '${{ inputs.generator }}'" fi @@ -83,6 +80,9 @@ runs: if [ -n '${{ inputs.args }}' ]; then ARGS="$ARGS ${{ inputs.args }}" fi + if [ '${{ inputs.run-test }}' == 'true' ]; then + TEST_ARGS="--test-dir '$BUILD_DIR' --output-on-failure --no-tests=error" + fi if [ -n '${{ inputs.test-args }}' ]; then TEST_ARGS="$TEST_ARGS ${{ inputs.test-args }}" fi