Skip to content

Commit 1459e13

Browse files
committed
Try coverage
1 parent 849d1de commit 1459e13

File tree

1 file changed

+82
-30
lines changed

1 file changed

+82
-30
lines changed

.github/workflows/coverage.yml

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828
- "**/cmake/**"
2929
- "**/modules/**"
3030
- "**/tests/**"
31+
- "!**/native/generated/**"
32+
- "!**/native/java*/**"
3133
- "!**/native/*_android.*"
3234
- "!**/native/*_apple.*"
3335
- "!**/native/*_emscripten.*"
@@ -51,7 +53,7 @@ env:
5153
IGNORE_ERRORS: "mismatch,gcov,source,negative,unused,empty"
5254

5355
jobs:
54-
coverage:
56+
cpp-coverage:
5557
runs-on: ubuntu-latest
5658

5759
steps:
@@ -61,11 +63,6 @@ jobs:
6163
- name: Setup Ninja
6264
uses: seanmiddleditch/gha-setup-ninja@master
6365

64-
- name: Setup and install python
65-
uses: actions/setup-python@v5
66-
with:
67-
python-version: "3.11"
68-
6966
- name: Install Dependencies
7067
run: sudo apt-get update && sudo apt-get install -y ${INSTALL_DEPS}
7168

@@ -90,20 +87,10 @@ jobs:
9087
working-directory: ${{ runner.workspace }}/build/tests/Debug
9188
run: ./yup_tests --gtest_output=xml:test_results.xml
9289

93-
- name: Build Python Wheels and Run Python Tests
94-
uses: pypa/[email protected]
95-
env:
96-
CIBW_ARCHS: x86_64
97-
CIBW_BUILD: cp311-manylinux_x86_64
98-
CIBW_TEST_SKIP: "*manylinux*"
99-
CIBW_DEBUG_TRACEBACK: TRUE
100-
CIBW_ENVIRONMENT: CIBW_DEBUG_TRACEBACK=TRUE YUP_ENABLE_COVERAGE=1
101-
with:
102-
package-dir: python
103-
104-
- name: Generate Combined Coverage Report
90+
- name: Generate C++ Coverage Report
10591
working-directory: ${{ runner.workspace }}/build
10692
run: |
93+
mkdir -p coverage
10794
lcov --directory . --capture --output-file coverage/coverage.info --ignore-errors ${IGNORE_ERRORS}
10895
lcov -r coverage/coverage.info \
10996
"*/thirdparty/*" \
@@ -113,17 +100,13 @@ jobs:
113100
"*/opt/*" \
114101
"*/CMakeFiles/*" \
115102
-o coverage/cpp.info --ignore-errors ${IGNORE_ERRORS}
116-
lcov -a ../python/wheelhouse/lcov.info "*" -a coverage/cpp.info "*" -o coverage/coverage_final.info --ignore-errors ${IGNORE_ERRORS}
117-
lcov --list coverage/coverage_final.info
103+
lcov --list coverage/cpp.info
118104
119-
- name: Upload Overall Coverage to Codecov
120-
uses: codecov/codecov-action@v4
105+
- name: Upload C++ Coverage Report
106+
uses: actions/upload-artifact@v4
121107
with:
122-
token: ${{ secrets.CODECOV_TOKEN }}
123-
file: ${{ runner.workspace }}/build/coverage/coverage_final.info
124-
name: overall-coverage
125-
fail_ci_if_error: false
126-
verbose: true
108+
name: cpp-coverage
109+
path: ${{ runner.workspace }}/build/coverage/cpp.info
127110

128111
- name: Upload Test Results
129112
uses: actions/upload-artifact@v4
@@ -132,9 +115,78 @@ jobs:
132115
name: test-results
133116
path: ${{ runner.workspace }}/build/tests/Debug/test_results.xml
134117

135-
- name: Upload Coverage Reports
118+
python-coverage:
119+
runs-on: ubuntu-latest
120+
121+
steps:
122+
- name: Checkout repository
123+
uses: actions/checkout@v4
124+
125+
- name: Setup and install python
126+
uses: actions/setup-python@v5
127+
with:
128+
python-version: "3.11"
129+
130+
- name: Install Dependencies
131+
run: sudo apt-get update && sudo apt-get install -y lcov
132+
133+
- name: Build Python Wheels and Run Python Tests
134+
uses: pypa/[email protected]
135+
env:
136+
CIBW_ARCHS: x86_64
137+
CIBW_BUILD: cp311-manylinux_x86_64
138+
CIBW_TEST_SKIP: "*manylinux*"
139+
CIBW_DEBUG_TRACEBACK: TRUE
140+
CIBW_ENVIRONMENT: CIBW_DEBUG_TRACEBACK=TRUE YUP_ENABLE_COVERAGE=1
141+
with:
142+
package-dir: python
143+
144+
- name: Upload Python Coverage Report
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: python-coverage
148+
path: python/wheelhouse/lcov.info
149+
150+
combine-coverage:
151+
runs-on: ubuntu-latest
152+
needs: [cpp-coverage, python-coverage]
153+
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v4
157+
158+
- name: Install Dependencies
159+
run: sudo apt-get update && sudo apt-get install -y lcov
160+
161+
- name: Download C++ Coverage Report
162+
uses: actions/download-artifact@v4
163+
with:
164+
name: cpp-coverage
165+
path: coverage/
166+
167+
- name: Download Python Coverage Report
168+
uses: actions/download-artifact@v4
169+
with:
170+
name: python-coverage
171+
path: coverage/
172+
173+
- name: Combine Coverage Reports
174+
run: |
175+
lcov -a coverage/cpp.info "*" -a coverage/lcov.info "*" -o coverage/coverage_final.info --ignore-errors ${IGNORE_ERRORS}
176+
lcov --list coverage/coverage_final.info
177+
178+
- name: Upload Combined Coverage to Codecov
179+
uses: codecov/codecov-action@v4
180+
with:
181+
token: ${{ secrets.CODECOV_TOKEN }}
182+
file: coverage/coverage_final.info
183+
name: overall-coverage
184+
fail_ci_if_error: false
185+
verbose: true
186+
187+
- name: Upload Combined Coverage Reports
136188
uses: actions/upload-artifact@v4
137189
if: always()
138190
with:
139-
name: coverage-reports
140-
path: ${{ runner.workspace }}/build/coverage/
191+
name: combined-coverage-reports
192+
path: coverage/

0 commit comments

Comments
 (0)