2017-11-03 17:28:26 +01:00
|
|
|
#!/bin/bash -eux
|
|
|
|
|
|
|
|
set -o pipefail
|
|
|
|
|
2017-11-09 13:38:23 +01:00
|
|
|
# Script invoked by DCI-Agents hooks/post-running.yml
|
|
|
|
|
2017-11-03 17:28:26 +01:00
|
|
|
|
|
|
|
if find test/results/coverage/ -mindepth 1 -name '.*' -prune -o -print -quit | grep -q .; then
|
|
|
|
stub=""
|
|
|
|
|
|
|
|
# shellcheck disable=SC2086
|
2019-08-05 22:29:50 +02:00
|
|
|
bin/ansible-test coverage xml -v --requirements --group-by command --group-by version ${stub:+"$stub"}
|
2017-11-03 17:28:26 +01:00
|
|
|
|
2017-11-09 13:38:23 +01:00
|
|
|
# upload coverage report to codecov.io
|
2017-11-03 17:28:26 +01:00
|
|
|
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}" \
|
|
|
|
-t 83cd8957-dc76-488c-9ada-210dcea51633 \
|
|
|
|
-X coveragepy \
|
|
|
|
-X gcov \
|
|
|
|
-X fix \
|
|
|
|
-X search \
|
|
|
|
-X xcode \
|
2017-11-09 12:43:41 +01:00
|
|
|
-K \
|
2017-11-03 17:28:26 +01:00
|
|
|
|| echo "Failed to upload code coverage report to codecov.io: ${file}"
|
|
|
|
done
|
|
|
|
fi
|