https://github.com/arduino/cpp-test-action
A GitHub Actions action for testing C/C++ projects
https://github.com/arduino/cpp-test-action
c c-plus-plus ci cmake continuous-integration coverage cpp github-actions unit-testing
Last synced: about 1 month ago
JSON representation
A GitHub Actions action for testing C/C++ projects
- Host: GitHub
- URL: https://github.com/arduino/cpp-test-action
- Owner: arduino
- License: other
- Created: 2020-10-09T06:43:08.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T12:03:29.000Z (about 1 year ago)
- Last Synced: 2025-04-05T05:51:14.000Z (8 months ago)
- Topics: c, c-plus-plus, ci, cmake, continuous-integration, coverage, cpp, github-actions, unit-testing
- Homepage:
- Size: 56.6 KB
- Stars: 17
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `arduino/cpp-test-action`
[](https://github.com/arduino/cpp-test-action/actions?workflow=Validate+action.yml)
[](https://github.com/arduino/cpp-test-action/actions?workflow=Spell+Check)
A [GitHub Actions](https://github.com/features/actions) action for testing C/C++ projects:
- Use [CMake](https://cmake.org/) to build tests
- Use [Valgrind](https://valgrind.org/) to check for memory leaks
- Use [LCOV](https://github.com/linux-test-project/lcov)/[GCOV](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html) to generate code coverage data and display a report in the log
## Inputs
### `source-path`
Path containing the `CMakeLists.txt` for the tests.
**Default**: `extras/test`
### `build-path`
The top-level directory for build output.
**Default**: `extras/test/build`
### `runtime-paths`
YAML format list of paths to runtime binaries generated by building the tests.
**Default**: `"- extras/test/build/bin/unit-test-binary"`
### `coverage-exclude-paths`
[YAML](https://en.wikipedia.org/wiki/YAML) format list of paths to remove from coverage data.
**Default**:
```yaml
- '*/extras/test/*'
- '/usr/*'
- '*/src/lib/*'
```
### `coverage-data-path`
Path to save the coverage data file to.
**Default**: `extras/test/build/coverage.info`
## Example usage
```yaml
on: [pull_request, push]
jobs:
test:
runs-on: ubuntu-latest
env:
COVERAGE_DATA_PATH: extras/coverage-data/coverage.info
steps:
- uses: actions/checkout@v2
- uses: arduino/cpp-test-action@v1
with:
coverage-data-path: ${{ env.COVERAGE_DATA_PATH }}
# Optional: upload coverage report to codecov.io
- uses: codecov/codecov-action@v1
with:
file: ${{ env.COVERAGE_DATA_PATH }}
```