https://github.com/jmarrec/testcpp-gha-coverage
A repo to test how to report coverage of a C++ project using Github Actions
https://github.com/jmarrec/testcpp-gha-coverage
coverage cpp github-actions tutorial
Last synced: 23 days ago
JSON representation
A repo to test how to report coverage of a C++ project using Github Actions
- Host: GitHub
- URL: https://github.com/jmarrec/testcpp-gha-coverage
- Owner: jmarrec
- License: mit
- Created: 2021-08-30T21:09:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-29T13:12:20.000Z (almost 2 years ago)
- Last Synced: 2024-06-11T16:07:38.755Z (11 months ago)
- Topics: coverage, cpp, github-actions, tutorial
- Language: CMake
- Homepage:
- Size: 124 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TestCpp-GHA-Coverage
[](https://github.com/jmarrec/TestCpp-GHA-Coverage/actions/workflows/build.yml)
[](https://codecov.io/gh/jmarrec/TestCpp-GHA-Coverage)
[](https://github.com/jmarrec/TestCpp-GHA-Coverage/actions/workflows/clang-format-check.yml)
[](https://github.com/jmarrec/TestCpp-GHA-Coverage/actions/workflows/cppcheck.yml)A repo to test how to report coverage of a C++ project using Github Actions, using https://codecov.io.
See:
* Example PRs [increasing](https://github.com/jmarrec/TestCpp-GHA-Coverage/pull/1) and [decreasing](https://github.com/jmarrec/TestCpp-GHA-Coverage/pull/2) coverage
* the Github Actions workflow at [.github/workflows/build.yml](.github/workflows/build.yml)----
## Additional
Additionally, it includes a [cppcheck action](.github/workflows/cppcheck.yml) with a custom python script ([ci/colorize_cppcheck_results.py](./ci/colorize_cppcheck_results.py)) I created that will print a summary of offenses and add color to your action.

There is also a [clang-format action](.github/workflows/clang-format-check.yml) that uses the `.clang-format` file in the repo.
(Note: A `.clang-tidy` file is also provided, but I didn't bother adding an action for that.)
## Multi platform support
`Person.cpp` has a few compiler specific macros, so that we can test merging reports from several platforms on codecov. See [src/Person.cpp#L18-L27](https://github.com/jmarrec/TestCpp-GHA-Coverage/blob/408d98bb68b05222006d052dd6367090827ed8fc/src/Person.cpp#L18-L27)
See [PR#5](https://github.com/jmarrec/TestCpp-GHA-Coverage/pull/5) for more info including before/after screenshots when I added Mac in addition to Ubuntu

See [PR#6](https://github.com/jmarrec/TestCpp-GHA-Coverage/pull/6) when I added Windows (via OpenCppCoverage) in addition to Mac and Ubuntu. **Looks like Windows's report don't merge correctly to codecov?**

**Note: Looks like there is a viewing problem where the clang line is no longer green, yet report is correctly at 100%**