-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.22 KB
/
code_cov.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
name: Code Coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
code-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ cmake lcov gcovr
sudo apt-get install -y libgtest-dev
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp ./lib/libgtest*.a /usr/lib
- name: Configure CMake
run: cmake -S . -B build -DBUILD_COVERAGE=ON
- name: Build
run: cmake --build build --config Release
- name: Run tests
run: |
cd build/test/unittest
./cpp-oasvalidator-unittests
- name: Generate Coverage Report
if: github.ref == 'refs/heads/main'
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}