-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (126 loc) · 5.25 KB
/
Copy pathcode_coverage.yml
File metadata and controls
144 lines (126 loc) · 5.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#
# Copyright 2023 Antony Peacock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
name: Code Coverage
on:
schedule:
- cron: "0 2 * * *" # Every day at 02:00 UTC
push:
branches: [main]
pull_request:
branches: [main]
env:
LCOV_VERSION: 2.5
jobs:
build:
runs-on: ${{ matrix.settings.os }}
strategy:
matrix:
configuration: [ "Debug" ]
settings:
- {
os: ubuntu-latest,
compiler: { type: GCC, version: 14, conan: "gcc", cc: "gcc-14", cxx: "g++-14", std: 23 },
lib: "libstdc++11"
}
steps:
- uses: actions/checkout@v6.0.2
- name: Install Latest GCC
shell: bash
run: |
sudo apt install -y g++-${{ matrix.settings.compiler.version }}
sudo rm -f /usr/bin/gcc /usr/bin/g++ /usr/bin/gcov
sudo ln -s /usr/bin/gcov-${{ matrix.settings.compiler.version }} /usr/bin/gcov
sudo ln -s /usr/bin/gcc-${{ matrix.settings.compiler.version }} /usr/bin/gcc
sudo ln -s /usr/bin/g++-${{ matrix.settings.compiler.version }} /usr/bin/g++
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Install Sphinx
run: |
sudo apt-get install -y python3-sphinx python3-sphinx-rtd-theme
- name: Install Lcov
shell: bash
run: |
wget https://github.com/linux-test-project/lcov/archive/refs/tags/v${{ env.LCOV_VERSION }}.tar.gz
tar -xvf v${{ env.LCOV_VERSION }}.tar.gz
cd lcov-${{ env.LCOV_VERSION }} && sudo make install && cd ..
sudo perl -MCPAN -e 'install Capture::Tiny'
sudo apt-get install -y libdatetime-perl
- name: Verify Lcov versions
run: |
genhtml --version
lcov --version
- name: Cache Conan Restore
uses: ./.github/actions/conan-cache-restore
with:
os: ${{ matrix.settings.os }}
build-type: ${{ matrix.configuration }}
conan-compiler: ${{ matrix.settings.compiler.conan }}
compiler-version: ${{ matrix.settings.compiler.version }}
stdlib: ${{ matrix.settings.lib }}
- name: Setup Conan
uses: ./.github/actions/setup-conan
with:
build-type: ${{ matrix.configuration }}
compiler-type: ${{ matrix.settings.compiler.type }}
compiler-version: ${{ matrix.settings.compiler.version }}
conan-compiler: ${{ matrix.settings.compiler.conan }}
stdlib: ${{ matrix.settings.lib }}
cppstd: ${{ matrix.settings.compiler.std }}
- name: Conan Install
shell: bash
run: |
conan install "${{ github.workspace }}" --build missing
- name: Configure CMake
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
cmake --preset ${{ env.CONAN_CONFIGURE_PRESET }} -DENABLE_CODE_COVERAGE=1
- name: Build
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }}
- name: Test
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
ctest --preset ${{ env.CONAN_BUILD_PRESET }} --rerun-failed --output-on-failure
- name: Generate Coverage Reports
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }} --target coverage
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }} --target coverage-lcov
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }} --target coverage-cobertura
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7.0.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ${{ github.workspace }}/build/${{ matrix.configuration }}/coverage/cobertura_coverage.xml
fail_ci_if_error: true
verbose: true
- name: Cache Conan Save
uses: ./.github/actions/conan-cache-save