@@ -308,4 +308,64 @@ jobs:
308308 with :
309309 github_token : ${{ secrets.GITHUB_TOKEN }}
310310 publish_dir : ./${{ steps.badge_dir.outputs.dir }}
311- destination_dir : ${{ steps.badge_dir.outputs.dir }}
311+ destination_dir : ${{ steps.badge_dir.outputs.dir }}
312+
313+ coverage :
314+ name : coverage / ubuntu-24.04 / gcc-14
315+ runs-on : ubuntu-24.04
316+ needs : build
317+
318+ steps :
319+ - name : Checkout
320+ uses : actions/checkout@v5
321+ with :
322+ fetch-depth : 0
323+
324+ - name : Install dependencies
325+ shell : bash
326+ run : |
327+ sudo apt-get update
328+ sudo apt-get install -y \
329+ cmake \
330+ ninja-build \
331+ gcc-14 \
332+ g++-14 \
333+ lcov
334+
335+ - name : Configure
336+ shell : bash
337+ env :
338+ CC : gcc-14
339+ CXX : g++-14
340+ run : |
341+ cmake -B build -G Ninja \
342+ -DCMAKE_BUILD_TYPE=Debug \
343+ -DCMAKE_C_STANDARD=17 \
344+ -DCMAKE_CXX_STANDARD=23 \
345+ -DCMAKE_C_COMPILER="$CC" \
346+ -DCMAKE_CXX_COMPILER="$CXX" \
347+ -DCMAKE_C_FLAGS="--coverage" \
348+ -DCMAKE_CXX_FLAGS="--coverage" \
349+ -DCMAKE_EXE_LINKER_FLAGS="--coverage" \
350+ -DCMAKE_SHARED_LINKER_FLAGS="--coverage"
351+
352+ - name : Build
353+ run : cmake --build build --parallel
354+
355+ - name : Test
356+ run : ctest --test-dir build --output-on-failure
357+
358+ - name : Capture coverage
359+ shell : bash
360+ run : |
361+ lcov --directory build --capture --output-file coverage.info
362+ lcov --remove coverage.info '/usr/*' '*/test/*' '*/_deps/*' --output-file coverage.info
363+ lcov --list coverage.info
364+
365+ - name : Upload coverage reports to Codecov
366+ uses : codecov/codecov-action@v5
367+ with :
368+ files : coverage.info
369+ fail_ci_if_error : true
370+ env :
371+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments