feat: add code coverage with branch coverage
All checks were successful
CI Code / Check spelling (pull_request) Successful in 19s
CI Code / Check coding style (pull_request) Successful in 39s
CI Code / Code Coverage (pull_request) Successful in 15m36s
CI Code / Linux (arch) (pull_request) Successful in 16m18s
CI Code / Linux (debian) (pull_request) Successful in 16m44s
CI Code / Linux (ubuntu) (pull_request) Successful in 17m42s

- Add --enable-coverage option to configure.ac
- Add coverage/coverage-html targets to Makefile.am
- Add coverage CI job with lcov + Codecov upload
- Include both unit and functional tests in coverage
- Enable branch coverage (step towards MC/DC)
- Add lcov to all Dockerfiles
- Add coverage/ to .gitignore
This commit is contained in:
2026-01-19 16:39:06 +03:00
parent 5a34a4a1d3
commit c1a60dc603
9 changed files with 57 additions and 0 deletions

View File

@@ -98,3 +98,33 @@ jobs:
- name: Check spelling
run: |
codespell
coverage:
runs-on: ubuntu-latest
name: Code Coverage
steps:
- uses: actions/checkout@v4
- name: Build and run coverage
run: |
docker build -f Dockerfile.debian -t profanity-cov .
docker run -v ${{ github.workspace }}/coverage:/coverage profanity-cov bash -c '
./bootstrap.sh
./configure --enable-coverage --enable-otr --enable-pgp --enable-omemo --enable-plugins
make -j$(nproc)
make check || true
make check-functional-parallel || true
lcov --capture --directory . --output-file /coverage/coverage.info \
--rc branch_coverage=1 \
--ignore-errors inconsistent
lcov --remove /coverage/coverage.info \
"/usr/include/*" "*/tests/*" \
--output-file /coverage/coverage.info \
--rc branch_coverage=1 \
--ignore-errors inconsistent,empty,unused
'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage/coverage.info
fail_ci_if_error: false
verbose: true