-
-
Notifications
You must be signed in to change notification settings - Fork 3
147 lines (123 loc) · 4.92 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
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
145
146
147
name: coverage
env:
COBERTURA_REPORT: cobertura.xml
COVERALLS_REPORT: coveralls.json
HTML_REPORT_DIR: html/
COVERAGE_ARTIFACT_NAME: coverage-report
on:
push:
branches: [main, development]
pull_request:
branches: [main, development]
jobs:
create-coverage-report:
runs-on: ubuntu-latest
container:
image: "ghcr.io/dnkpp/gcc:14"
steps:
- uses: actions/checkout@v4
- name: Install gcovr
run: |
python -m pip install gcovr
- name: Configure
env:
LDFLAGS: "-fprofile-arcs"
CXXFLAGS: "-g -O0 --coverage -fno-inline -fprofile-abs-path -fkeep-inline-functions -fkeep-static-functions"
run: |
cmake -S . \
-B build \
-D CMAKE_BUILD_TYPE="Debug" \
-D MIMICPP_ENABLE_ADAPTER_TESTS=YES \
-D MIMICPP_CONFIG_EXPERIMENTAL_CATCH2_MATCHER_INTEGRATION=YES \
-D MIMICPP_CONFIG_EXPERIMENTAL_UNICODE_STR_MATCHER=YES
- name: Build
run: |
cmake --build build -j4
- name: Run tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/test/unit-tests -C Debug -j4
- name: Run adapter tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/test/adapter-tests -C Debug -j4
- name: Run custom-stacktrace-tests
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/test/custom-stacktrace-tests -C Debug -j4
- name: Run examples
env:
CTEST_OUTPUT_ON_FAILURE: 1
run: ctest --test-dir build/examples -C Debug -j4
- name: Run gcovr
run: |
# circumvnet "fatal: detected dubious ownership in repository" error
git config --global --add safe.directory /__w/mimicpp/mimicpp
gcovr --root build/test/unit-tests --filter "include/mimic++" --keep -j4 -v \
--exclude-lines-by-pattern "\s*assert\(|\s*unreachable\(\);" \
--exclude-unreachable-branches \
--exclude-function-lines \
--exclude-noncode-lines \
--exclude-throw-branches \
--decisions \
--calls \
--cobertura ${{env.COBERTURA_REPORT}} --cobertura-pretty \
--html-nested ${{env.HTML_REPORT_DIR}} --html-title "mimic++ Coverage Report" \
--coveralls ${{env.COVERALLS_REPORT}} --coveralls-pretty
- name: Upload gcov coverage report artifacts
uses: actions/upload-artifact@v4
with:
name: gcov-files
path: "build/test/unit-tests/*.gcov"
- name: Upload generated report artifacts
uses: actions/upload-artifact@v4
with:
name: ${{env.COVERAGE_ARTIFACT_NAME}}
path: |
${{env.COBERTURA_REPORT}}
${{env.COVERALLS_REPORT}}
${{env.HTML_REPORT_DIR}}
codacy-report:
needs: create-coverage-report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{env.COVERAGE_ARTIFACT_NAME}}
- name: Upload coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{secrets.CODACY_PROJECT_TOKEN}}
coverage-reports: ${{env.COBERTURA_REPORT}}
codecov-report:
needs: create-coverage-report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{env.COVERAGE_ARTIFACT_NAME}}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
name: $GITHUB_REPOSITORY
token: ${{secrets.CODECOV_TOKEN}}
files: ${{env.COBERTURA_REPORT}}
fail_ci_if_error: true
verbose: true
coveralls-report:
needs: create-coverage-report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: ${{env.COVERAGE_ARTIFACT_NAME}}
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
file: ${{env.COVERALLS_REPORT}}
format: coveralls
fail-on-error: true