From bdae72ef6cbdb04a69de42045bec26868ff6356f Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 17 May 2021 17:06:22 -0700 Subject: [PATCH] Add fallback for coverage report generation. This should allow the same script to be used for two different scenarios: - ansible-core across multiple versions (not all of which support `--docker` for coverage reports) - collections (which should always use the `devel` branch for coverage reports) --- .azure-pipelines/scripts/report-coverage.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/scripts/report-coverage.sh b/.azure-pipelines/scripts/report-coverage.sh index d1bb6380662..050464be362 100755 --- a/.azure-pipelines/scripts/report-coverage.sh +++ b/.azure-pipelines/scripts/report-coverage.sh @@ -12,4 +12,6 @@ if ! ansible-test --help >/dev/null 2>&1; then pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check fi -ansible-test coverage xml --stub --docker --color -v +# Generate stubs using docker (if supported) otherwise fall back to using a virtual environment instead. +# The use of docker is required when Powershell code is present, but Ansible 2.12 was the first version to support --docker with coverage. +ansible-test coverage xml --stub --docker --color -v || ansible-test coverage xml --stub --venv --venv-system-site-packages --color -v