summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/docker/.azure-pipelines/scripts/report-coverage.sh
blob: e8d82c747e6b5376250df78de2a48e76584cd000 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
# Generate code coverage reports for uploading to Azure Pipelines and codecov.io.

# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

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