Use GitHub Action for code coverage reporting.

This commit is contained in:
Jeff Geerling
2020-03-05 08:58:53 -06:00
parent f7b951c475
commit f5c9dcdd29
2 changed files with 6 additions and 36 deletions

View File

@@ -54,8 +54,12 @@ jobs:
- name: Run integration tests on Python ${{ matrix.python_version }}
run: ansible-test integration --docker -v --color --retry-on-error --python ${{ matrix.python_version }} --continue-on-error --diff --coverage
- name: Upload coverage data
run: tests/coverage.sh
- name: Generate coverage report.
run: ansible-test coverage xml -v --requirements --group-by command --group-by version
- uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
molecule:
runs-on: ubuntu-latest

View File

@@ -1,34 +0,0 @@
#!/bin/bash -eux
set -o pipefail
# Script Collection CI
# Once working, we may move this script elsewhere - gundalow
if find tests/output/coverage/ -mindepth 1 -name '.*' -prune -o -print -quit | grep -q .; then
stub=""
# shellcheck disable=SC2086
ansible-test coverage xml -v --requirements --group-by command --group-by version ${stub:+"$stub"}
# upload coverage report to codecov.io
# Example: tests/output/coverage/integration=kubernetes_team=docker-default=python-3.6=coverage.98a48352c8fc.4207.186313
for file in tests/output/coverage/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 d6ff3062-7455-4de8-a8cb-55b3b1ddf5b2 \ # kubernetes
-X coveragepy \
-X gcov \
-X fix \
-X search \
-X xcode \
-K \
|| echo "Failed to upload code coverage report to codecov.io: ${file}"
done
fi