Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Verbose Input #43

Merged
merged 3 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ jobs:
- name: Test Project
uses: ./ctest-action

- name: Test Project Verbosely
uses: ./ctest-action
with:
verbose: true

test-action-with-test-dir:
name: Test Action With Test Directory Specified
runs-on: ubuntu-latest
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ By default, this action invokes `ctest` with the `--output-on-failure` and `--no
| `test-dir` | Path | Specifies the directory in which to look for tests. It defaults to the `build` directory. |
| `build-config` | String | Chooses the configuration to test. |
| `tests-regex` | Regex pattern | Runs tests matching the regular expression. |
| `verbose` | Enable verbose output from tests. |
| `args` | Multiple strings | Additional arguments to pass during the CTest run. |

## Example Usages
Expand All @@ -38,7 +39,7 @@ jobs:
run-build: true

- name: Test Project
uses: threeal/ctest-action@v1.0.0
uses: threeal/ctest-action@v1.1.0
```

### Testing in a Different Directory
Expand All @@ -47,7 +48,7 @@ By default, this action runs tests in the `build` directory. To run tests in a d

```yaml
- name: Test Project
uses: threeal/ctest-action@v1.0.0
uses: threeal/ctest-action@v1.1.0
with:
test-dir: sample/build
```
Expand All @@ -58,7 +59,7 @@ Some projects may require a build configuration to be specified to run tests. To

```yaml
- name: Test Project
uses: threeal/ctest-action@v1.0.0
uses: threeal/ctest-action@v1.1.0
with:
build-config: Debug
```
Expand All @@ -69,7 +70,7 @@ A regular expression pattern can be provided by specifying the `tests-regex` inp

```yaml
- name: Test Project
uses: threeal/ctest-action@v1.0.0
uses: threeal/ctest-action@v1.1.0
with:
tests-regex: ^test sample
```
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ inputs:
description: Chooses the configuration to test
tests-regex:
description: Runs tests matching the regular expression
verbose:
description: Enable verbose output from tests
args:
description: Additional arguments to pass during the CTest run
runs:
using: composite
steps:
- name: Test the CMake project
shell: ${{ runner.os == 'Windows' && 'pwsh' || 'bash' }}
run: ctest --test-dir '${{ inputs.test-dir }}'${{ inputs.build-config && format(' --build-config ''{0}''', inputs.build-config) }}${{ inputs.tests-regex && format(' --tests-regex ''{0}''', inputs.tests-regex) }} --output-on-failure --no-tests=error ${{ inputs.args }}
run: ctest --test-dir '${{ inputs.test-dir }}'${{ inputs.build-config && format(' --build-config ''{0}''', inputs.build-config) }}${{ inputs.tests-regex && format(' --tests-regex ''{0}''', inputs.tests-regex) }}${{ inputs.verbose && ' --verbose' }} --output-on-failure --no-tests=error ${{ inputs.args }}