forked from vincentlaucsb/csv-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.25 KB
/
Copy pathcoverage.yml
File metadata and controls
82 lines (70 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Code Coverage
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
pull-requests: write
env:
CSV_FETCHCONTENT_BASE_DIR: ${{ github.workspace }}/.cache/fetchcontent
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v5
with:
submodules: recursive
- name: Cache CMake FetchContent dependencies
uses: actions/cache@v5
with:
path: ${{ env.CSV_FETCHCONTENT_BASE_DIR }}
key: fetchcontent-${{ runner.os }}-coverage-${{ hashFiles('CMakeLists.txt', 'tests/CMakeLists.txt') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lcov
- name: Configure CMake with coverage instrumentation
run: >
cmake -B build
-DCMAKE_BUILD_TYPE=Debug
-DENABLE_CODE_COVERAGE=ON
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_C_COMPILER=gcc
-DCSV_CXX_STANDARD=17
-S ${{ github.workspace }}
- name: Build
run: cmake --build build --config Debug
- name: Run tests
working-directory: build
run: ctest --build-config Debug --output-on-failure
- name: Capture coverage data
run: |
lcov --capture \
--directory build \
--output-file coverage.info \
--ignore-errors mismatch,source,empty,unused,negative \
--rc lcov_branch_coverage=1
# Strip system headers, external deps, Catch2, and test files
lcov --remove coverage.info \
'/usr/*' \
'*/external/*' \
'*/catch2/*' \
'*/Catch2/*' \
'*/tests/*' \
--output-file coverage.info \
--ignore-errors empty,unused \
--rc lcov_branch_coverage=1
lcov --list coverage.info --ignore-errors empty,unused --rc lcov_branch_coverage=1
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.info
flags: cpp
name: cpp-core
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
override_commit: ${{ github.event.pull_request.head.sha || github.sha }}
override_pr: ${{ github.event.pull_request.number }}