Skip to content

Commit 9d46336

Browse files
committed
Merge branch '18-build-add-code-coverage-report' into staging
2 parents b4f0eb3 + 0b4054e commit 9d46336

2 files changed

Lines changed: 62 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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 }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
[![CI](https://github.com/vargalabs/libdecimal/actions/workflows/ci.yml/badge.svg)](https://github.com/vargalabs/libdecimal/actions/workflows/ci.yml)
3-
[![codecov](https://codecov.io/gh/vargalabs/libdecimal/branch/main/graph/badge.svg)](https://codecov.io/gh/vargalabs/libdecimal)
3+
[![codecov](https://codecov.io/gh/vargalabs/libdecimal/graph/badge.svg?token=F6YCNG3HEY)](https://codecov.io/gh/vargalabs/libdecimal)
44
[![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
55
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.19323619.svg)](https://doi.org/10.5281/zenodo.19323619)
66
[![GitHub release](https://img.shields.io/github/v/release/vargalabs/libdecimal.svg)](https://github.com/vargalabs/libdecimal/releases)

0 commit comments

Comments
 (0)