Skip to content

Commit 01ea603

Browse files
Coverage: Fix providing coverage data for upload from GitHub CI
Signed-off-by: Bernhard Kaindl <[email protected]>
1 parent bc245bb commit 01ea603

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ github_checks:
3737
#
3838
annotations: true
3939

40+
codecov:
41+
token: 37ee4f08-37b2-404b-bf4d-254891cf6f30 # Codecov coverage upload token
42+
4043
#
4144
# Pull request comments:
4245
# ----------------------

tox.ini

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ commands =
2424
# https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md
2525
# https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers
2626
echo "::add-matcher::.github/workflows/PYTHONWARNINGS-problemMatcher.json"
27-
pytest --cov -v --new-first -x --show-capture=all -rA
27+
echo "::group::pytest"
28+
pytest --cov -v --new-first -x --show-capture=all -rA --junitxml={envlogdir}/junit.xml -o junit_family=legacy
29+
echo "::endgroup::"
2830
sh -c 'if [ -n "{env:PYTEST_MD_REPORT_OUTPUT}" -a -n "{env:GITHUB_STEP_SUMMARY}" ];then \
2931
mkdir -p $(dirname "{env:GITHUB_STEP_SUMMARY:.git/sum.md}"); \
3032
sed "s/tests\(.*py\)/[&](&)/" \
@@ -72,6 +74,9 @@ passenv =
7274
pytype: GITHUB_REF_NAME
7375
test: PYTEST_ADDOPTS
7476
test: PYTEST_XDIST_WORKER_COUNT
77+
cov: TESTS_COVERAGE_MIN
78+
cov: XCP_COVERAGE_MIN
79+
cov: DIFF_COVERAGE_MIN
7580
covcp: UPLOAD_DIR
7681
covcp: HOME
7782
check: MYPY_FORCE_COLOR
@@ -105,7 +110,7 @@ commands =
105110
# covcombine shall not call [cov]commands: diff-cover shall check the combined cov:
106111
{cov,covcp}: {[cov]commands}
107112
{py27-test}: pylint --py3k --disable=no-absolute-import xcp/
108-
covcp: cp -av {envlogdir}/coverage.xml {env:UPLOAD_DIR:.}
113+
covcp: cp -av {envlogdir}/coverage.xml {envlogdir}/coverage.lcov {envlogdir}/.coverage {envlogdir}/junit.xml {env:UPLOAD_DIR:.}
109114
covcombine: {[covcombine]commands}
110115
fox: {[covcombine]commands}
111116
fox: {[lint]commands}
@@ -118,12 +123,13 @@ setenv = PY3_DIFFCOVER_OPTIONS=--ignore-whitespace --show-uncovered
118123
extras = coverage
119124
test
120125
commands =
121-
coverage xml -o {envlogdir}/coverage.xml --fail-under {env:XCP_COV_MIN:68}
126+
coverage xml -o {envlogdir}/coverage.xml --fail-under {env:XCP_COVERAGE_MIN:78}
127+
coverage lcov -o {envlogdir}/coverage.lcov
122128
coverage html -d {envlogdir}/htmlcov
123-
coverage html -d {envlogdir}/htmlcov-tests --fail-under {env:TESTS_COV_MIN:96} \
129+
coverage html -d {envlogdir}/htmlcov-tests --fail-under {env:TESTS_COVERAGE_MIN:96} \
124130
--include="tests/*"
125-
diff-cover --compare-branch=origin/master \
126-
{env:PY3_DIFFCOVER_OPTIONS} --fail-under {env:DIFF_COV_MIN:92} \
131+
diff-cover --compare-branch=origin/master --exclude xcp/dmv.py \
132+
{env:PY3_DIFFCOVER_OPTIONS} --fail-under {env:DIFF_COVERAGE_MIN:92} \
127133
--html-report {envlogdir}/coverage-diff.html \
128134
{envlogdir}/coverage.xml
129135

0 commit comments

Comments
 (0)