summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorSviatoslav Sydorenko (Святослав Сидоренко) <wk@sydorenko.org.ua>2024-09-17 22:45:06 +0200
committerGitHub <noreply@github.com>2024-09-17 22:45:06 +0200
commitcf25a093230865fdce94e07f5376c4e948288b01 (patch)
tree7c0c9c26dfccb42429a4aba5909e0b948a53b937 /Makefile
parentUpload API unit test results to dashboard (#15532) (diff)
downloadawx-cf25a093230865fdce94e07f5376c4e948288b01.tar.xz
awx-cf25a093230865fdce94e07f5376c4e948288b01.zip
🧪 Upload ansible-test coverage to Codecov (#15527)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 16 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 124119ce70..252b3c6982 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ COLLECTION_TEST_TARGET ?=
# args for collection install
COLLECTION_PACKAGE ?= awx
COLLECTION_NAMESPACE ?= awx
-COLLECTION_INSTALL = ~/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE)
+COLLECTION_INSTALL = $(HOME)/.ansible/collections/ansible_collections/$(COLLECTION_NAMESPACE)/$(COLLECTION_PACKAGE)
COLLECTION_TEMPLATE_VERSION ?= false
# NOTE: This defaults the container image version to the branch that's active
@@ -424,10 +424,23 @@ test_collection_sanity:
if ! [ -x "$(shell command -v ansible-test)" ]; then pip install ansible-core; fi
ansible --version
COLLECTION_VERSION=1.0.0 $(MAKE) install_collection
- cd $(COLLECTION_INSTALL) && ansible-test sanity $(COLLECTION_SANITY_ARGS)
+ cd $(COLLECTION_INSTALL) && \
+ ansible-test sanity $(COLLECTION_SANITY_ARGS) --coverage --junit && \
+ ansible-test coverage xml --requirements --group-by command --group-by version
+ @if [ "${GITHUB_ACTIONS}" = "true" ]; \
+ then \
+ echo cov-report-files="$$(find "$(COLLECTION_INSTALL)/tests/output/reports/" -type f -name 'coverage=sanity*.xml' -print0 | tr '\0' ',' | sed 's#,$$##')" >> "${GITHUB_OUTPUT}"; \
+ echo test-result-files="$$(find "$(COLLECTION_INSTALL)/tests/output/junit/" -type f -name '*.xml' -print0 | tr '\0' ',' | sed 's#,$$##')" >> "${GITHUB_OUTPUT}"; \
+ fi
test_collection_integration: install_collection
- cd $(COLLECTION_INSTALL) && ansible-test integration -vvv $(COLLECTION_TEST_TARGET)
+ cd $(COLLECTION_INSTALL) && \
+ ansible-test integration --coverage -vvv $(COLLECTION_TEST_TARGET) && \
+ ansible-test coverage xml --requirements --group-by command --group-by version
+ @if [ "${GITHUB_ACTIONS}" = "true" ]; \
+ then \
+ echo cov-report-files="$$(find "$(COLLECTION_INSTALL)/tests/output/reports/" -type f -name 'coverage=integration*.xml' -print0 | tr '\0' ',' | sed 's#,$$##')" >> "${GITHUB_OUTPUT}"; \
+ fi
test_unit:
@if [ "$(VENV_BASE)" ]; then \