Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-circle

GitHub Action

Gcovr Action

v0.1.0

Gcovr Action

check-circle

Gcovr Action

Generate code coverage reports for a C++ project using gcovr

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Gcovr Action

uses: threeal/gcovr-action@v0.1.0

Learn more about this action in threeal/gcovr-action

Choose a version

Gcovr Action

latest version license test status

Generate code coverage report for C++ project on GitHub Actions using gcovr.

Usage

For more information, see action.yml and the GitHub Actions guide.

Inputs

Note: All inputs are optional.

Name Value Type Description
root Path The root directory of your source files. Defaults to current directory. File names are reported relative to this root.
gcov-executable Executable name with optional arguments Use a particular gcov executable. Must match the compiler you are using, e.g. llvm-cov gcov for LLVM. See this.
exclude Regular expression Exclude source files that match this filter.
fail-under-line 0 - 100 Fail if the total line coverage is less than this value.
coveralls-out Path Output file of generated Coveralls API coverage report.
coveralls-send true or false Send Coveralls API coverage report to it's endpoint (default: false).
coveralls-repo-token Token Coveralls repo token, required for sending Coveralls API coverage report successfully. See this.

Standard Example

name: test
on:
  push:
jobs:
  test-coverage:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3.2.0

      - name: Build and test project
        run: |
          cmake . -B build
          cmake --build build
          ctest --test-dir build

      - name: Generate code coverage report
        uses: threeal/gcovr-action@latest

Using LLVM

- name: Build and test project
  run: |
    cmake . -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
    cmake --build build
    ctest --test-dir build

- name: Generate code coverage report
  uses: threeal/gcovr-action@latest
  with:
    gcov-executable: llvm-cov gcov

Send to Coveralls

- name: Generate and send code coverage report to Coveralls
  uses: threeal/gcovr-action@latest
  with:
    coveralls-send: true
    coveralls-repo-token: ${{ secrets.COVERALLS_REPO_TOKEN }}

License

This project is maintained by Alfi Maulana and licensed under the MIT License.