A GitHub Actions action for testing C/C++ projects:
- Use CMake to build tests
- Use Valgrind to check for memory leaks
- Use LCOV/GCOV to generate code coverage data and display a report in the log
Path containing the CMakeLists.txt
for the tests.
Default: extras/test
The top-level directory for build output.
Default: extras/test/build
YAML format list of paths to runtime binaries generated by building the tests.
Default: "- extras/test/build/bin/unit-test-binary"
YAML format list of paths to remove from coverage data.
Default:
- '*/extras/test/*'
- '/usr/*'
- '*/src/lib/*'
Path to save the coverage data file to.
Default: extras/test/build/coverage.info
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@main
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 }}