forked from PaloAltoNetworks/pan-os-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (61 loc) · 2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Taken from: https://github.com/sensu/sensu-go-ansible/blob/master/Makefile
# Make sure we have ansible_collections/paloaltonetworks/panos_enhanced
# as a prefix. This is ugly as heck, but it works. I suggest all future
# developer to treat next few lines as an opportunity to learn a thing or two
# about GNU make ;)
collection := $(notdir $(realpath $(CURDIR) ))
namespace := $(notdir $(realpath $(CURDIR)/.. ))
toplevel := $(notdir $(realpath $(CURDIR)/../..))
err_msg := Place collection at <WHATEVER>/ansible_collections/paloaltonetworks/panos
ifneq (panos,$(collection))
$(error $(err_msg))
else ifneq (paloaltonetworks,$(namespace))
$(error $(err_msg))
else ifneq (ansible_collections,$(toplevel))
$(error $(err_msg))
endif
python_version := $(shell \
python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))' \
)
.PHONY: help
help:
@echo Available targets:
@fgrep "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sort
.PHONY: sanity
sanity: ## Run sanity tests
ansible-test sanity --python $(python_version)
.PHONY: units
units: ## Run unit tests
./fix-pytest-ini.py
-ansible-test coverage erase # On first run, there is nothing to erase.
ansible-test units --python $(python_version) --coverage
ansible-test coverage html
.PHONY: integration
integration: ## Run integration tests
$(MAKE) -C tests/integration $(CI)
.PHONY: docs
docs: ## Build collection documentation
$(MAKE) -C docs -f Makefile.custom docs
.PHONY: clean
clean: ## Remove all auto-generated files
$(MAKE) -C docs -f Makefile.custom clean
rm -rf tests/output
format:
black .
isort .
check-format:
black --check .
isort --check .
sync-deps:
pipenv lock -r > requirements.txt
install:
rm -f paloaltonetworks*
ansible-galaxy collection build . --force
ansible-galaxy collection install paloaltonetworks* --force
rm -f paloaltonetworks*
doctest:
for i in $$(ls -1 plugins/modules | grep -v init); do \
echo "Checking $$i..." ; \
ansible-doc -M plugins/modules $$i > /dev/null ; \
done
.PHONY: install doctest