-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (69 loc) · 2.63 KB
/
Makefile
File metadata and controls
92 lines (69 loc) · 2.63 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
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
.PHONY: clean docs help test venv
.DEFAULT_GOAL := help
APP=acid/app.py
SETTINGS_DEV=config/settings.yml
SETTINGS_TEST=config/test/settings_test.yml
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
install: ## install required dependencies
pip install -r requirements.txt
install-dev: install ## install required dependencies with test-requirements
pip install -r requirements.txt
pip install -r test-requirements.txt
clean: clean-build clean-pyc clean-cache clean-session clean-venv ## clean all artifacts and cache
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr *.egg-info
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
clean-cache: ## remove .cache and .pytest_cache
rm -rf .cache
rm -rf .pytest_cache
clean-session: ## remove flask_session files
rm -rf flask_session/
lint: ## check code style and formatting with flake8
flake8
test-unit: missing-conf ## run all unit tests
ifndef FEATURE
-SETTINGS_PATH=$(SETTINGS_TEST) FLASK_APP=$(APP) pytest -m unit
else
-SETTINGS_PATH=$(SETTINGS_TEST) FLASK_APP=$(APP) pytest -m 'unit and $(FEATURE)'
endif
test-integration: missing-conf ## run all integration tests
ifndef FEATURE
-SETTINGS_PATH=$(SETTINGS_TEST) FLASK_APP=$(APP) pytest -m integration
else
-SETTINGS_PATH=$(SETTINGS_TEST) FLASK_APP=$(APP) pytest -m 'integration and $(FEATURE)'
endif
test: test-unit test-integration ## run all tests
coverage: clean-cache ## create code coverage report
coverage erase
SETTINGS_PATH=$(SETTINGS_TEST) FLASK_APP=$(APP) coverage run -m pytest -m unit
coverage report -m
coverage html
docs: ## generate Sphinx HTML documentation
$(MAKE) -C docs clean
$(MAKE) -C docs html
serve: ## run Flask server in development mode
SETTINGS_PATH=$(SETTINGS_DEV) FLASK_ENV=development FLASK_APP=$(APP) flask run --port 3000
dev-run: ## run vagrant box with Zuul and Gerrit
vagrant up
dev-stop: ## stop vagrant box
vagrant halt
dev-reload: ## remove vagrant box and run again
vagrant destroy -f
vagrant up
clean-venv: ## clean virtual environment
rm -rf .venv/
venv: clean-venv ## create basic virtual environment
python3.6 -m venv .venv
. .venv/bin/activate; \
pip install --upgrade pip; \
pip install setuptools wheel; \
$(MAKE) install-dev; \
missing-conf: ## create missing configuration files from samples
find . -type f -not -path "./.*" -name "*.sample" -exec sh -c \
'for f; do if ! [ -e "$${f%.sample}" ]; then cp "$$f" "$${f%.sample}"; fi; done' _ {} +