Skip to content

Commit 3dfa34d

Browse files
authored
Switch to using coveralls github action for reporting (#3594)
1 parent 2c15480 commit 3dfa34d

3 files changed

Lines changed: 34 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
LIBMESH: ${{ matrix.libmesh }}
7676
NPY_DISABLE_CPU_FEATURES: "AVX512F AVX512_SKX"
7777
OPENBLAS_NUM_THREADS: 1
78+
PYTEST_ADDOPTS: --cov=openmc --cov-report=lcov:coverage-python.lcov
7879
# libfabric complains about fork() as a result of using Python multiprocessing.
7980
# We can work around it with RDMAV_FORK_SAFE=1 in libfabric < 1.13 and with
8081
# FI_EFA_FORK_SAFE=1 in more recent versions.
@@ -171,11 +172,37 @@ jobs:
171172
uses: mxschmitt/action-tmate@v3
172173
timeout-minutes: 10
173174

174-
- name: after_success
175+
- name: Generate C++ coverage (gcovr)
175176
shell: bash
176177
run: |
177-
cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json
178-
coveralls --merge=cpp_cov.json --service=github
178+
# Produce LCOV directly from gcov data in the build tree
179+
gcovr \
180+
--root "$GITHUB_WORKSPACE" \
181+
--object-directory "$GITHUB_WORKSPACE/build" \
182+
--filter "$GITHUB_WORKSPACE/src" \
183+
--filter "$GITHUB_WORKSPACE/include" \
184+
--exclude "$GITHUB_WORKSPACE/src/external/.*" \
185+
--exclude "$GITHUB_WORKSPACE/src/include/openmc/external/.*" \
186+
--gcov-ignore-errors source_not_found \
187+
--gcov-ignore-errors output_error \
188+
--gcov-ignore-parse-errors suspicious_hits.warn \
189+
--print-summary \
190+
--lcov -o coverage-cpp.lcov || true
191+
192+
- name: Merge C++ and Python coverage
193+
shell: bash
194+
run: |
195+
# Merge C++ and Python LCOV into a single file for upload
196+
cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov
197+
198+
- name: Upload coverage to Coveralls
199+
if: ${{ hashFiles('coverage.lcov') != '' }}
200+
uses: coverallsapp/github-action@v2
201+
with:
202+
github-token: ${{ secrets.GITHUB_TOKEN }}
203+
parallel: true
204+
flag-name: C++ and Python
205+
path-to-lcov: coverage.lcov
179206

180207
finish:
181208
needs: main
@@ -184,5 +211,5 @@ jobs:
184211
- name: Coveralls Finished
185212
uses: coverallsapp/github-action@v2
186213
with:
187-
github-token: ${{ secrets.github_token }}
214+
github-token: ${{ secrets.GITHUB_TOKEN }}
188215
parallel-finished: true

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ docs = [
4848
"sphinxcontrib-svg2pdfconverter",
4949
"sphinx-rtd-theme"
5050
]
51-
test = ["packaging", "pytest", "pytest-cov", "colorama", "openpyxl"]
52-
ci = ["cpp-coveralls", "coveralls"]
51+
test = ["packaging", "pytest", "pytest-cov>=4.0", "colorama", "openpyxl"]
52+
ci = ["coverage>=7.4", "gcovr>=7.2"]
5353
vtk = ["vtk"]
5454

5555
[project.urls]

tools/ci/gha-script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [[ $EVENT == 'y' ]]; then
1515
fi
1616

1717
# Run unit tests and then regression tests
18-
pytest --cov=openmc -v $args \
18+
pytest -v $args \
1919
tests/test_matplotlib_import.py \
2020
tests/unit_tests \
2121
tests/regression_tests

0 commit comments

Comments
 (0)