-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
121 lines (104 loc) · 2.61 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.SILENT:
include .manala/Makefile
NAMESPACE = manala
COLLECTION = path
VERSION = $(shell yq '.version' galaxy.yml)
###########
# Version #
###########
## Version - Get collection version
version: SHELL := $(MANALA_DOCKER_SHELL)
version:
printf $(VERSION)
.PHONY: version
########
# Lint #
########
## Lint - Lint collection [VERBOSE]
lint: SHELL := $(MANALA_DOCKER_SHELL)
lint:
ansible-lint \
$(if $(VERBOSE), -v) \
--force-color
.PHONY: lint
########
# Test #
########
## Test - Run all collection tests (but doc and coverage)
test: test.sanity test.units test.integration
.PHONY: test
## Test - Run collection sanity tests [VERBOSE]
test.sanity: SHELL := $(MANALA_DOCKER_SHELL)
test.sanity:
ansible-test sanity \
--requirements \
--venv \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
--color yes \
--exclude .github/ \
--exclude .manala/
.PHONY: test.sanity
## Test - Run collection units tests [VERBOSE|COVERAGE]
test.units: SHELL := $(MANALA_DOCKER_SHELL)
test.units:
ansible-test units \
--requirements \
--venv \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
$(if $(COVERAGE), --coverage) \
--color yes
.PHONY: test.units
## Test - Run collection integration tests [VERBOSE|COVERAGE]
test.integration: SHELL := $(MANALA_DOCKER_SHELL)
test.integration:
ansible-test integration \
--requirements \
--venv \
--python 3.11 \
$(if $(VERBOSE), --verbose) \
$(if $(COVERAGE), --coverage) \
--color yes
.PHONY: test.integration
## Test - Run collection documentation tests [VERBOSE]
test.doc: SHELL := $(MANALA_DOCKER_SHELL)
test.doc:
$(foreach type,module filter, \
$(foreach plugin,$(shell ansible-doc --list $(NAMESPACE).$(COLLECTION) --type $(type) --json | jq --raw-output 'keys[]'), \
ansible-doc \
$(if $(VERBOSE), --verbose) \
--type $(type) \
$(plugin) > /dev/null && \
) \
) true
.PHONY: test.doc
## Test - Run collection coverage [VERBOSE]
test.coverage: SHELL := $(MANALA_DOCKER_SHELL)
test.coverage:
ansible-test coverage xml \
--requirements \
--venv \
--python 3.11 \
--group-by command \
--group-by version \
$(if $(VERBOSE), --verbose) \
--color yes
.PHONY: test.coverage
###################
# Build / Publish #
###################
## Build - Build collection [VERBOSE]
build: SHELL := $(MANALA_DOCKER_SHELL)
build:
ansible-galaxy collection build \
--output-path build \
--force \
$(if $(VERBOSE), --verbose)
.PHONY: build
## Publish - Publish collection [VERBOSE]
publish: SHELL := $(MANALA_DOCKER_SHELL)
publish:
ansible-galaxy collection publish build/$(NAMESPACE)-$(COLLECTION)-$(VERSION).tar.gz \
$(if $(VERBOSE), --verbose)
.PHONY: publish