forked from sensu/sensu-go-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (49 loc) · 1.76 KB
/
Makefile
File metadata and controls
60 lines (49 loc) · 1.76 KB
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
# Make sure we have ansible_collections/sensu/sensu_go 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/sensu/sensu_go
ifneq (sensu_go,$(collection))
$(error $(err_msg))
else ifneq (sensu,$(namespace))
$(error $(err_msg))
else ifneq (ansible_collections,$(toplevel))
$(error $(err_msg))
endif
# Make sure ansible can find our collection without having to install it.
export ANSIBLE_COLLECTIONS_PATHS ?= $(realpath $(CURDIR)/../../..)
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: requirements
requirements: ## Install development requirements
pip install \
-r sanity.requirements \
-r units.requirements \
-r integration.requirements \
-r docs.requirements
.PHONY: sanity
sanity: ## Run sanity tests
flake8
ansible-lint -p roles/*
ansible-test sanity --python $(python_version)
.PHONY: units
units: ## Run unit tests
-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