-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (53 loc) · 1.76 KB
/
test.yml
File metadata and controls
67 lines (53 loc) · 1.76 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
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential libgtest-dev lcov
cd /usr/src/googletest
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
make --build build
sudo make install
- name: Configure & build (with coverage)
run: |
cmake -S . -B build \
-DENABLE_COVERAGE=ON \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
- name: Zero coverage counters
run: lcov -d build -z
- name: Run tests
run: ctest --test-dir build --output-on-failure
- name: Debug coverage output
run: |
echo "=== .gcno files in build ==="
find build -type f -name '*.gcno' || echo "(none)"
echo "=== .gcda files anywhere ==="
find . -type f -name '*.gcda' || echo "(none)"
- name: Capture coverage
run: lcov -d build -c -o coverage.info
- name: Filter coverage
run: lcov -r coverage.info '/usr/*' '*/test/*' -o coverage.filtered.info
- name: Generate HTML report
run: genhtml coverage.filtered.info --output-directory coverage-report
- name: Upload coverage-report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage-report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.filtered.info
fail_ci_if_error: true