mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-13 13:02:01 +00:00
Issue #15: Add codecov coverage reporting like grafana collection.
This commit is contained in:
3
.github/workflows/ansible-test.yml
vendored
3
.github/workflows/ansible-test.yml
vendored
@@ -48,3 +48,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Run integration tests on Python ${{ matrix.python_version }}
|
- 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
|
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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Kubernetes Collection for Ansible
|
# Kubernetes Collection for Ansible
|
||||||
|
|
||||||
[](https://github.com/ansible-collections/kubernetes/actions)
|
[](https://github.com/ansible-collections/kubernetes/actions) 
|
||||||
|
|
||||||
This repo hosts the `community.kubernetes` Ansible Collection.
|
This repo hosts the `community.kubernetes` Ansible Collection.
|
||||||
|
|
||||||
|
|||||||
4
codecov.yml
Normal file
4
codecov.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
coverage:
|
||||||
|
precision: 2
|
||||||
|
round: down
|
||||||
|
range: "70...100"
|
||||||
34
tests/coverage.sh
Executable file
34
tests/coverage.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/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 TODO \ # 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
|
||||||
Reference in New Issue
Block a user