-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (78 loc) · 2.45 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
79
80
81
82
83
84
name: Coverage
on:
push:
branches: [ master, main ]
pull_request:
branches: [ '**' ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
jobs:
coverage-linux:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get install ninja-build
pip install gcovr
gcovr --version
- name: Install Conan 2
run: |
pip install conan
conan profile detect
- name: Build
run: |
mkdir build
conan install . -of build --build=missing -s compiler.cppstd=20
cmake . -B build -DSIMFIL_WITH_COVERAGE=YES -DSIMFIL_WITH_TESTS=YES -DCMAKE_BUILD_TYPE=Debug -DSIMFIL_FPIC=YES -DSIMFIL_SHARED=NO -DSIMFIL_WITH_COVERAGE=YES -GNinja
cmake --build build
- name: Run CTest
working-directory: build/test
run: |
ctest --verbose --output-junit result-junit.xml
- name: Run Gcovr
run: |
mkdir coverage
gcovr --html-details coverage/coverage.html \
--filter src/ --filter include/
gcovr --cobertura coverage.xml \
--html coverage.html \
--filter src/ --filter include/
less coverage.xml
- name: Publish Coverage HTML
uses: actions/upload-artifact@v3
with:
name: Test Coverage
path: coverage
- name: Upload coverage HTML to Gist
# Upload only for main branch
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
uses: andymckay/append-gist-action@1fbfbbce708a39bd45846f0955ed5521f2099c6d
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/johannes-wolf/61e57af50757b03e0c7cd119ec2d2f4b
file: coverage.html
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: coverage.xml
badge: false
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '50 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md