Enable codecov.io and add coverage grouping.

This commit is contained in:
Matt Clay 2017-05-15 17:42:11 +08:00
commit 6a2a7a2392
6 changed files with 131 additions and 22 deletions

View file

@ -52,8 +52,30 @@ find lib/ansible/modules -type d -empty -print -delete
function cleanup
{
if find test/results/coverage/ -mindepth 1 -name '.*' -prune -o -print -quit | grep -q .; then
ansible-test coverage xml --color -v --requirements
cp -a test/results/reports/coverage.xml shippable/codecoverage/coverage.xml
ansible-test coverage xml --color -v --requirements --group-by command --group-by version
cp -a test/results/reports/coverage=*.xml shippable/codecoverage/
# upload coverage report to codecov.io only when using complete on-demand coverage
if [ "${COVERAGE}" ] && [ "${CHANGED}" == "" ]; then
for file in test/results/reports/coverage=*.xml; do
flags="${file##*/coverage=}"
flags="${flags%.xml}"
flags="${flags//=/,}"
flags="${flags//[^a-zA-Z0-9_,]/_}"
bash <(curl -s https://codecov.io/bash) \
-f "${file}" \
-F "${flags}" \
-n "${TEST}" \
-t 83cd8957-dc76-488c-9ada-210dcea51633 \
-X coveragepy \
-X gcov \
-X fix \
-X search \
-X xcode \
|| echo "Failed to upload code coverage report to codecov.io: ${file}"
done
fi
fi
rmdir shippable/testresults/