forked from debops/debops
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (105 loc) · 3.25 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# DebOps Makefile
.PHONY: all
all:
.PHONY: help
help:
@printf "%s\n" "Useful targets:"
@egrep '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m make %-20s\033[0m %s\n", $$1, $$2}'
.PHONY: check
check: ## Perform project sanity checks
check: fail-if-git-dirty
.PHONY: clean
clean: ## Clean up project directory
clean: clean-tests clean-sdist clean-wheel
.PHONY: docker
docker: ## Check Docker image build
docker: test-docker-build
.PHONY: docs
docs: ## Build Sphinx documentation
docs: test-docs
.PHONY: pep8
pep8: ## Test Python PEP8 compliance
pep8: test-pep8
.PHONY: shell
shell: ## Test shell script syntax
shell: test-shell
.PHONY: syntax
syntax: ## Check Ansible playbook syntax
syntax: test-playbook-syntax
.PHONY: test
test: ## Perform all DebOps tests
test: test-all
.PHONY: yaml
yaml: ## Test YAML syntax using yamllint
yaml: test-yaml
.PHONY: sdist
sdist: ## Create Python sdist package
sdist: clean-sdist
@python setup.py sdist
.PHONY: sdist-quiet
sdist-quiet: clean-sdist
@python setup.py --quiet sdist
.PHONY: sdist-sign
sdist-sign: ## Create signed Python sdist package
sdist-sign: sdist
@gpg --detach-sign --armor dist/debops-*.tar.gz
.PHONY: clean-sdist
clean-sdist:
@rm -vrf debops.egg-info dist/debops-*.tar.gz*
.PHONY: wheel
wheel: ## Create Python wheel package
wheel: clean-wheel
@python setup.py bdist_wheel
.PHONY: wheel-quiet
wheel-quiet: clean-wheel
@python setup.py --quiet bdist_wheel
.PHONY: wheel-sign
wheel-sign: ## Create signed Python wheel package
wheel-sign: wheel
@gpg --detach-sign --armor dist/debops-*.whl
.PHONY: clean-wheel
clean-wheel:
@rm -vrf build debops.egg-info dist/debops-*.whl*
.PHONY: twine-upload
twine-upload: ## Upload Python packages to PyPI
@twine upload dist/*
.PHONY: test-all
test-all: clean-tests test-pep8 test-debops-tools test-docs test-playbook-syntax test-yaml test-shell test-docker-build
.PHONY: test-pep8
test-pep8:
@printf "%s\n" "Testing PEP8 compliance using pycodestyle..."
@pycodestyle --show-source --statistics .
@./lib/tests/check-pep8
.PHONY: test-shell
test-shell:
@printf "%s\n" "Testing shell syntax using shellcheck..."
@./lib/tests/check-shell
.PHONY: test-docker-build
test-docker-build:
@./lib/tests/check-docker-build
.PHONY: clean-tests
clean-tests:
@rm -vrf .coverage docs/_build/* docs/ansible/roles/*/defaults.rst
.PHONY: test-docs
test-docs:
@printf "%s\n" "Testing HTML documentation generation..."
@cd docs && sphinx-build -n -W -b html -d _build/doctrees . _build/html
.PHONY: test-playbook-syntax
test-playbook-syntax:
@printf "%s\n" "Testing Ansible playbook syntax..."
@ANSIBLE_ROLES_PATH="ansible/roles" ansible-playbook --syntax-check \
ansible/playbooks/bootstrap.yml \
ansible/playbooks/site.yml
.PHONY: test-yaml
test-yaml:
@printf "%s\n" "Testing YAML syntax using yamllint..."
@yamllint .
.PHONY: test-debops-tools
test-debops-tools:
@printf "%s\n" "Testing debops-tools using nose2..."
@nose2 --with-coverage
.PHONY: fail-if-git-dirty
fail-if-git-dirty:
@git diff --quiet && git diff --cached --quiet || ( \
printf "%s\n" "Sanity check: uncommited git changes detected" ; \
git status --short ; exit 1 )