Skip to content

Commit 4d42a41

Browse files
committed
added the tests for python and C++ and combined test report into unified reports
1 parent ed88315 commit 4d42a41

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,54 @@ jobs:
200200
- name: Build Documentation
201201
run: |
202202
sphinx-build -b html docs/source/ docs/build/html
203+
204+
test-python-cpp-unified-report:
205+
runs-on: ubuntu-latest
206+
timeout-minutes: 20
207+
steps:
208+
- name: Checkout Repository
209+
uses: actions/checkout@v4
210+
211+
- name: Set up Python
212+
uses: actions/setup-python@v5
213+
with:
214+
python-version: "3.11"
215+
216+
- name: Install Python Dependencies
217+
run: |
218+
python -m pip install --upgrade pip
219+
python -m pip install pytest pytest-cov cobertura-merge
220+
221+
- name: Run Python Tests
222+
run: |
223+
pytest tests/ --cov=src --cov-report xml:coverage-python.xml --cov-report html:coverage-html
224+
225+
- name: Install C++ Dependencies
226+
run: |
227+
sudo apt-get update
228+
sudo apt-get install -y g++ gcov lcov
229+
230+
- name: Compile and Run C++ Tests
231+
run: |
232+
g++ -o tests/test_cpp tests/test.cpp
233+
./tests/test_cpp
234+
lcov --capture --directory . --output-file coverage-cpp.info
235+
236+
- name: Convert C++ Coverage to XML
237+
run: |
238+
python -m pip install gcovr
239+
gcovr -r . --xml-pretty --output coverage-cpp.xml
240+
241+
- name: Combine Coverage Reports
242+
run: |
243+
python -m cobertura_merge coverage-python.xml coverage-cpp.xml -o unified-reports/combined-coverage.xml
244+
245+
- name: Generate HTML Report
246+
run: |
247+
python -m pip install coverage html-report
248+
coverage html -i --data unified-reports/combined-coverage.xml --directory unified-reports/html
249+
250+
- name: Upload Combined Coverage to Codecov
251+
run: bash <(curl -s https://codecov.io/bash) -f unified-reports/combined-coverage.xml
252+
env:
253+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)