community.docker/.azure-pipelines/scripts/report-coverage.sh
patchback[bot] dc86cbef58
Skip Ansible 2.9 coverage reporting with new AZP container. (#384) (#385)
ci_coverage

(cherry picked from commit c4e2117844)

Co-authored-by: Felix Fontein <felix@fontein.de>
2022-06-14 21:48:57 +02:00

20 lines
810 B
Bash
Executable File

#!/usr/bin/env bash
# Generate code coverage reports for uploading to Azure Pipelines and codecov.io.
set -o pipefail -eu
PATH="${PWD}/bin:${PATH}"
if [[ "$(ansible --version)" =~ \ 2\.9\. ]]; then
exit
fi
if ! ansible-test --help >/dev/null 2>&1; then
# Install the devel version of ansible-test for generating code coverage reports.
# This is only used by Ansible Collections, which are typically tested against multiple Ansible versions (in separate jobs).
# Since a version of ansible-test is required that can work the output from multiple older releases, the devel version is used.
pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check
fi
ansible-test coverage xml --group-by command --stub --venv --venv-system-site-packages --color -v