-
Notifications
You must be signed in to change notification settings - Fork 2
/
django.mk
82 lines (68 loc) · 2.4 KB
/
django.mk
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
# VERSION=1.9.0
# CHANGES:
# 1.9.0 - Use coverage tool directly to generate coverage
# reports.
# - wheel and pip updates
# - Use pre-compiled binary wheel for cryptography
# - Remove Travis references
# 1.8.0 - 2019-10-21 - Don't run flake8 on local_settings.py
# 1.7.0 - 2018-05-31 - Now using python 3 by default
# - Removed virtualenv.py in favor of python 3's
# builtin venv capability.
# 1.6.0 - 2017-09-05 - add bandit secure analysis configuration
# 1.5.0 - 2017-08-24 - remove jshint/jscs in favor of eslint
# 1.4.0 - 2017-06-06 - backout the switch to eslint. that's not really ready yet.
# 1.3.0 - 2017-06-05 - pypi location is not needed anymore
# 1.2.0 - 2016-12-15 - bump wheel version to 0.29
# 1.1.0 - 2016-11-08 - run flake8 tests before unit tests
# 1.0.1 - 2016-05-02 - Remove deprecated syncdb command from make install
VE ?= ./ve
MANAGE ?= ./manage.py
REQUIREMENTS ?= requirements.txt
SYS_PYTHON ?= python3
PY_SENTINAL ?= $(VE)/sentinal
WHEEL_VERSION ?= 0.43.0
PIP_VERSION ?= 24.0
MAX_COMPLEXITY ?= 10
INTERFACE ?= localhost
RUNSERVER_PORT ?= 8000
PY_DIRS ?= $(APP)
BANDIT ?= $(VE)/bin/bandit
FLAKE8 ?= $(VE)/bin/flake8
PIP ?= $(VE)/bin/pip
COVERAGE ?= $(VE)/bin/coverage
jenkins: check flake8 test bandit
$(PY_SENTINAL): $(REQUIREMENTS)
rm -rf $(VE)
$(SYS_PYTHON) -m venv $(VE)
$(PIP) install pip==$(PIP_VERSION)
$(PIP) install --upgrade setuptools
$(PIP) install wheel==$(WHEEL_VERSION)
$(PIP) install --no-deps --requirement $(REQUIREMENTS)
touch $@
test: $(PY_SENTINAL)
$(COVERAGE) run --source='.' --omit=$(VE)/* $(MANAGE) test $(PY_DIRS)
$(COVERAGE) xml -o reports/coverage.xml
parallel-tests: $(PY_SENTINAL)
$(MANAGE) test --parallel
bandit: $(PY_SENTINAL)
$(BANDIT) --ini ./.bandit -r $(PY_DIRS)
flake8: $(PY_SENTINAL)
$(FLAKE8) $(PY_DIRS) --max-complexity=$(MAX_COMPLEXITY) --exclude=*/local_settings.py,*/migrations/*.py --extend-ignore=$(FLAKE8_IGNORE)
runserver: check
$(MANAGE) runserver $(INTERFACE):$(RUNSERVER_PORT)
migrate: check jenkins
$(MANAGE) migrate
check: $(PY_SENTINAL)
$(MANAGE) check
shell: $(PY_SENTINAL)
$(MANAGE) shell_plus
clean:
rm -rf $(VE)
rm -rf media/CACHE
rm -rf reports
rm -f celerybeat-schedule
rm -f .coverage
rm -rf node_modules
find . -name '*.pyc' -exec rm {} \;
.PHONY: jenkins test flake8 runserver migrate check shell clean