build: Add coverage support with codecov.io

This change adds code coverage to the Meson builds, and reports them to
codecov.io, to help keep the code coverage high.
fix-issue-63
nirenjan 2026-03-16 22:39:12 -07:00
parent 45d561e0d8
commit 08a6b0a736
1 changed files with 44 additions and 0 deletions

44
.github/workflows/coverage.yml vendored 100644
View File

@ -0,0 +1,44 @@
name: Code Coverage
permissions:
contents: read
on:
push:
branches:
- '*'
- '!gh-pages'
pull_request:
branches:
- 'master'
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install dependencies
run: |
./.github/scripts/install-dependencies-ubuntu.sh
sudo apt-get install -y gcovr
- name: Configure and Build
run: |
meson setup build -Db_coverage=true --buildtype=debug
meson compile -C build
- name: Run Tests
run: meson test -C build
- name: Generate Coverage Report
run: |
# This generates the XML report for the upload step
ninja -C build coverage-xml
- name: Upload Report to Codecov
uses: codecov/codecov-action@v5
with:
files: buildd/meson-logs/coverage.xml
fail_ci_if_error: true