-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.56 KB
/
ci.yml
File metadata and controls
54 lines (46 loc) · 1.56 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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install deps (GTest, lcov)
run: |
sudo apt-get update
sudo apt-get install -y lcov libgtest-dev cmake pkg-config libgsl-dev
# Build GoogleTest (if you vendor it, skip this)
sudo apt-get install -y cmake
sudo cmake -S /usr/src/googletest -B /usr/src/googletest/build
sudo cmake --build /usr/src/googletest/build --target install
- name: Build tests with coverage
run: |
make clean
make test COVERAGE=1 CXX=g++
- name: Run tests
run: ./bin/test_main
- name: Generate coverage (LCOV)
run: |
lcov --capture \
--directory obj --directory bin \
--gcov-tool gcov-13 \
--rc geninfo_unexecuted_blocks=1 \
--ignore-errors empty,mismatch \
--output-file coverage.raw.info
# Then prune noise (tests and system headers)
lcov --remove coverage.raw.info '/usr/*' '*/tests/*' \
--output-file coverage.info
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.info
flags: unittests
name: ubuntu-gcc
fail_ci_if_error: true
env:
# Public repos don't need a token. Private repos: add a secret CODECOV_TOKEN
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}