-
Notifications
You must be signed in to change notification settings - Fork 35
78 lines (68 loc) · 1.98 KB
/
coverage.yml
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
name: Coverage
on:
push:
branches: [main]
pull_request:
paths:
- '.github/workflows/coverage.yml'
- 'cmake/**'
- 'src/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'codecov.yml'
jobs:
Coverage:
name: Code Coverage
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout Repository
uses: actions/[email protected]
with:
fetch-depth: 10
- name: Dependencies
run: |
sudo apt-get install ccache lcov
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Get number of CPU cores
uses: SimenB/[email protected]
id: cpu-cores
- name: Cache Build
id: cache-build
uses: actions/[email protected]
with:
path: ${{ env.CACHE_PATH }}
key: coverage-cache
- name: Prepare ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats\
- name: Configure
run: |
mkdir -p build
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
-DIPC_TOOLKIT_WITH_CODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Release \
- name: Build
run: |
cmake --build build -j ${{ steps.cpu-cores.outputs.count }}
ccache --show-stats
- name: Run Coverage
run: |
cd build
ctest --verbose -j ${{ steps.cpu-cores.outputs.count }}
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' "$HOME/.cache/*" "*tests/*" --output-file coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
fail_ci_if_error: true
files: build/coverage.info
flags: unittests
name: ipc-toolkit
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true