-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (44 loc) · 1.32 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
# Definitions
ECHO=echo
GREP=grep
TEST_ANSIBLE=molecule test
LINT_ANSIBLE=ansible-lint
LINT_YAML=yamllint
PIPENV=PIPENV_VENV_IN_PROJECT=1 pipenv
VIRUAL_ENV=.venv
ROLES_PATH=roles
# Targets
default: help
.PHONY: test
test: $(VIRUAL_ENV) ## Test Ansible roles
@$(PIPENV) run $(TEST_ANSIBLE)
.PHONY: test-debian
test-debian: $(VIRUAL_ENV) ## Test Ansible roles in Debian
@$(PIPENV) run $(TEST_ANSIBLE) --platform-name molecule-debian-11
.PHONY: test-fedora
test-fedora: $(VIRUAL_ENV) ## Test Ansible roles in Fedora
@$(PIPENV) run $(TEST_ANSIBLE) --platform-name molecule-fedora
.PHONY: test-ubuntu
test-ubuntu: $(VIRUAL_ENV) ## Test Ansible roles in Ubuntu
@$(PIPENV) run $(TEST_ANSIBLE) --platform-name molecule-ubuntu-2004
.PHONY: lint
lint: $(VIRUAL_ENV) ## Lint source
@$(PIPENV) run $(LINT_ANSIBLE) $(ROLES_PATH)
.PHONY: lint-yaml
lint-yaml: $(VIRUAL_ENV) ## Lint YAML source
@$(PIPENV) run $(LINT_YAML) .
.PHONY: env-lock
env-lock: ## Update environment lock file
@$(PIPENV) lock
.PHONY: env-update
env-update: ## Update environment
@$(PIPENV) sync --dev
.PHONY: clean
clean: ## Clean generated files, including virtual environment
@$(PIPENV) --rm
.PHONY: help
help: ## This menu
@$(GREP) -P "##\s(.*)$$" $(MAKEFILE_LIST) | sed 's/:.*##/:/' | sort
$(VIRUAL_ENV):
@$(ECHO) "Creating virtual environment"
@$(PIPENV) sync --dev