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