Skip to content

Commit fb8fc55

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

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

tox.ini

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ commands =
3333
# https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md
3434
# https://github.com/actions/toolkit/blob/main/docs/commands.md#problem-matchers
3535
echo "::add-matcher::.github/workflows/PYTHONWARNINGS-problemMatcher.json"
36-
pytest --cov -v --new-first -x --show-capture=all -rA
36+
echo "::group::pytest"
37+
pytest --cov -v --new-first -x --show-capture=all -rA --junitxml={envlogdir}/junit.xml -o junit_family=legacy
38+
echo "::endgroup::"
3739
sh -c 'if [ -n "{env:PYTEST_MD_REPORT_OUTPUT}" -a -n "{env:GITHUB_STEP_SUMMARY}" ];then \
3840
mkdir -p $(dirname "{env:GITHUB_STEP_SUMMARY:.git/sum.md}"); \
3941
sed "s/tests\(.*py\)/[&](&)/" \
@@ -81,6 +83,9 @@ passenv =
8183
pytype: GITHUB_REF_NAME
8284
test: PYTEST_ADDOPTS
8385
test: PYTEST_XDIST_WORKER_COUNT
86+
cov: TESTS_COVERAGE_MIN
87+
cov: XCP_COVERAGE_MIN
88+
cov: DIFF_COVERAGE_MIN
8489
covcp: UPLOAD_DIR
8590
covcp: HOME
8691
check: MYPY_FORCE_COLOR
@@ -114,7 +119,7 @@ commands =
114119
# covcombine shall not call [cov]commands: diff-cover shall check the combined cov:
115120
{cov,covcp}: {[cov]commands}
116121
{py27-test}: pylint --py3k --disable=no-absolute-import xcp/
117-
covcp: cp -av {envlogdir}/coverage.xml {env:UPLOAD_DIR:.}
122+
covcp: cp -av {envlogdir}/coverage.xml {envlogdir}/coverage.lcov {envlogdir}/.coverage {envlogdir}/junit.xml {env:UPLOAD_DIR:.}
118123
covcombine: {[covcombine]commands}
119124
fox: {[covcombine]commands}
120125
fox: {[lint]commands}
@@ -127,12 +132,13 @@ setenv = PY3_DIFFCOVER_OPTIONS=--ignore-whitespace --show-uncovered
127132
extras = coverage
128133
test
129134
commands =
130-
coverage xml -o {envlogdir}/coverage.xml --fail-under {env:XCP_COV_MIN:68}
135+
coverage xml -o {envlogdir}/coverage.xml --fail-under {env:XCP_COVERAGE_MIN:78}
136+
coverage lcov -o {envlogdir}/coverage.lcov
131137
coverage html -d {envlogdir}/htmlcov
132-
coverage html -d {envlogdir}/htmlcov-tests --fail-under {env:TESTS_COV_MIN:96} \
138+
coverage html -d {envlogdir}/htmlcov-tests --fail-under {env:TESTS_COVERAGE_MIN:96} \
133139
--include="tests/*"
134-
diff-cover --compare-branch=origin/master \
135-
{env:PY3_DIFFCOVER_OPTIONS} --fail-under {env:DIFF_COV_MIN:92} \
140+
diff-cover --compare-branch=origin/master --exclude xcp/dmv.py \
141+
{env:PY3_DIFFCOVER_OPTIONS} --fail-under {env:DIFF_COVERAGE_MIN:92} \
136142
--html-report {envlogdir}/coverage-diff.html \
137143
{envlogdir}/coverage.xml
138144

0 commit comments

Comments
 (0)