-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
69 lines (54 loc) · 1.43 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
VENV=venv
COVERAGE=$(VENV)/bin/coverage
PIP=$(VENV)/bin/pip
PYTHON=$(VENV)/bin/python
FLAKE8=$(VENV)/bin/flake8
.PHONY: run
run: venv rulesengine/db.sqlite3
$(PYTHON) rulesengine/manage.py runserver_plus 0.0.0.0:8000
.PHONY: format
format:
$(VENV)/bin/black .
.PHONY: check
check: lint test benchmark
.PHONY: benchmark
benchmark: venv clean-db fuzz-large
cd rulesengine; \
../$(PYTHON) manage.py benchmark
.PHONY: test
test: runtests coveragereport
.PHONY: runtests
runtests: venv
cd rulesengine; \
../$(COVERAGE) run --source=rules --omit="*/migrations/*,*/admin.py,*/apps.py,*/test_*" ./manage.py test
.PHONY: coveragereport
coveragereport:
cd rulesengine; \
../$(COVERAGE) report -m --skip-covered; \
rm -f .coverage
.PHONY: lint
lint: venv
$(FLAKE8) rulesengine --exclude migrations,settings.py
rulesengine/db.sqlite3: venv
cd rulesengine; \
../$(PYTHON) manage.py migrate;
.PHONY: fuzz-large
fuzz-large: rulesengine/db.sqlite3
cd rulesengine; \
../$(PYTHON) manage.py loaddata rules/fixtures/fuzzed-large.json
.PHONY: fuzz-small
fuzz-small:
cd rulesengine; \
../$(PYTHON) manage.py loaddata rules/fixtures/fuzzed-large.json
venv:
virtualenv --python `which python3` venv
$(PIP) install -r requirements.txt
.PHONY: clean
clean: clean-db clean-files
.PHONY: clean-db
clean-db:
rm -rf rulesengine/db.sqlite3
.PHONY: clean-files
clean-files:
rm -rf venv
find rulesengine/ -name __pycache__ -or -name "*.py[co]" -exec rm -rf {} \;