Open Thinkpiet opened 11 months ago
Alternatively (or in addition), we could also use this action or this one on pull requests to monitor the test coverage of all files changed. A simple script could calculate the coverage of functions in the modified files: 1) Get all modified files
git diff --name-only $GITHUB_BASE_REF | grep -E '^[^(test)].*((\.h)|(\.cpph)|(\.cpp))$'
2) Get all corresponding tests TN: SF: <full/source/file/path> ... end_of_record ...
from the trace file build/coverage.info
3) Get a list of all lines with functions in the corresponding file (All information should be contained in the trace file)
ctags -x --c-types=f <source/file/path> | grep function | awk '{print $3}'
4) Compute the coverage only for the changed files (SF: <full/source/file/path>
) based on the trace file, e.g. function coverage using FNDA: <execution count>,<function>
. (s. FILES section in lcov documentation)
Alternatively, it might be much simpler just to extract this information from the HTML coverage report using Beautiful Soup.
Test code coverage data could be uploaded via actions/upload-artifact@v4.
Possible advantages: