Skip to content

A GitHub Actions action for testing C/C++ projects

License

Notifications You must be signed in to change notification settings

arduino/cpp-test-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino/cpp-test-action

Validate Spell Check

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

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 format list of paths to remove from coverage data.

Default:

- '*/extras/test/*'
- '/usr/*'
- '*/src/lib/*'

coverage-data-path

Path to save the coverage data file to.

Default: extras/test/build/coverage.info

Example usage

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 }}