Debian Codegraph @

ansible_collections/community/docker/.azure-pipelines/scripts/aggregate-coverage.sh

raw
1 #!/usr/bin/env bash
2 # Aggregate code coverage results for later processing.
3
4 # Copyright (c) Ansible Project
5 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
6 # SPDX-License-Identifier: GPL-3.0-or-later
7
8 set -o pipefail -eu
9
10 agent_temp_directory="$1"
11
12 PATH="${PWD}/bin:${PATH}"
13
14 mkdir "${agent_temp_directory}/coverage/"
15
16 if [[ "$(ansible --version)" =~ \ 2\.9\. ]]; then
17 exit
18 fi
19
20 options=(--venv --venv-system-site-packages --color -v)
21
22 ansible-test coverage combine --group-by command --export "${agent_temp_directory}/coverage/" "${options[@]}"
23
24 if ansible-test coverage analyze targets generate --help >/dev/null 2>&1; then
25 # Only analyze coverage if the installed version of ansible-test supports it.
26 # Doing so allows this script to work unmodified for multiple Ansible versions.
27 ansible-test coverage analyze targets generate "${agent_temp_directory}/coverage/coverage-analyze-targets.json" "${options[@]}"
28 fi