-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
146 lines (109 loc) · 3.8 KB
/
Makefile
File metadata and controls
146 lines (109 loc) · 3.8 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
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
136
137
138
139
140
141
142
143
144
145
146
ifeq (, $(ENV))
ENV := development
env := development
else ifeq (test, $(ENV))
env := testing
else
env := $(ENV)
endif
ifeq (, $(NODE_ENV))
NODE_ENV := development
endif
app := rapperswil_jona
.DEFAULT_GOAL = test\:coverage
default: test\:coverage
# -- setup
setup: ## Install Python packages
pip install -e '.[${env}]' -c constraints.txt
.PHONY: setup
setup\:force: ## Install Python packages with `--force-reinstall`
pip install --upgrade --force-reinstall -e '.[${env}]' -c constraints.txt
.PHONY: setup\:force
setup\:update: ## Update Python packages
pip install --upgrade -e '.[${env}]' -c constraints.txt
.PHONY: setup\:update
# -- serve
serve: ## Run server process (development)
./bin/serve --env development --config config/development.ini --reload
.PHONY: serve
serve\:production: ## Run {server,worker} process both in production mode (see Procfile)
honcho start
.PHONY: serve\:production
# -- test
test: ## Run unit tests and functional tests both
ENV=test py.test -c 'config/testing.ini' -s -q \
test/unit test/func test/route_test.py
.PHONY: test
test\:unit: ## Run unit tests
ENV=test py.test -c 'config/testing.ini' -s -q \
test/unit
.PHONY: test\:unit
test\:func: ## Run functional tests
ENV=test py.test -c 'config/testing.ini' -s -q \
test/func
.PHONY: test\:func
test\:route: ## Run only route tests
ENV=test py.test -c 'config/testing.ini' -s -q \
test/route_test.py
.PHONY: test\:route
test\:integration: ## Run integration tests on browser (Firefox Headless)
ENV=test TEST_DOMAIN=localhost TEST_SESSION_COOKIE_DOMAIN=localhost \
py.test -c 'config/testing.ini' -s -v \
--driver Firefox --driver-path ./bin/geckodriver test/integration
.PHONY: test\:integration
test\:doc: ## Run doctest in Python code
ENV=test ./bin/run_doctest
.PHONY: test\:doc
test\:coverage: ## Run `test` with coverage outputs
ENV=test py.test -c 'config/testing.ini' -s -q \
test/unit test/func test/route_test.py \
--cov=${app} --cov-report term-missing:skip-covered
.PHONY: test\:coverage
# -- vet
vet: | vet\:style vet\:lint ## Run `vet:style` and `vet:lint` both (without vet:quality)
.PHONY: vet
vet\:style: ## Check style using py{code,doc}style (see setup.cfg)
pycodestyle test ${app}
pydocstyle test ${app}
.PHONY: vet\:style
vet\:lint: | vet\:lint\:py vet\:lint\:js ## Lint Python and JavaScript codes at once
.PHONY: vet\:lint
vet\:lint\:py: ## Lint Python codes
pylint test ${app}
.PHONY: vet\:lint\:py
vet\:lint\:js: ## Lint JavaScript codes
eslint rollup.config.js
eslint ${app}/assets
.PHONY: vet\:lint\:js
# -- utilities
pack: ## Assemble assets using rollup
NODE_ENV=$(NODE_ENV) rollup -c
.PHONY: pack
build: | setup pack ## (Re) Run setup and pack at once
.PHONY: build
clean: ## Delete unnecessary cache etc.
find . ! -readable -prune -o \
! -path "./.git/*" ! -path "./node_modules/*" ! -path "./venv*" \
! -path "./doc/*" ! -path "./locale/*" ! -path "./tmp/*" \
! -path "./lib/*" -print | \
grep -E "(__pycache__|\.egg-info|\.pyc|\.pyo)" | \
xargs rm -rf
.PHONY: clean
shell: ## Open python REPL in application context
ENV=$(ENV) ${app}_pshell 'config/${env}.ini#${app}' --python-shell ptpython
.PHONY: shell
routes: ## Display all routes for the application
ENV=$(ENV) ${app}_proute 'config/${env}.ini#${app}'
.PHONY: routes
expose: ## Print untracked (volatile) files
git ls-files --others | \
grep -vE '(lib|tmp|test|static|db|locale|node_modules|\.?cache)/' | \
grep -vE '(__pycache__|\.egg-info|venv)/' | \
grep -vE '(\.coverage|\.*-version|bin\/gitlab*)'
.PHONY: expose
help: ## Display this message
@grep -E '^[0-9a-z\:\\]+: ' $(MAKEFILE_LIST) | grep -E ' ## ' | \
sed -e 's/\(\s|\(\s[0-9a-z\:\\]*\)*\) / /' | tr -d \\\\ | \
awk 'BEGIN {FS = ": ## "}; {printf "\033[36m%-17s\033[0m %s\n", $$1, $$2}' | \
sort
.PHONY: help