-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
82 lines (64 loc) · 1.92 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
ENV = env
BIN = $(ENV)/bin
PYTHON_VERSION = 3.10
PYTHON = $(BIN)/python
GIT_STATUS = "$(shell git status --porcelain)"
UPGRADE = yes
ifeq ($(UPGRADE),yes)
REQUIREMENTS_UPGRADE=--upgrade
else
REQUIREMENTS_UPGRADE=--no-upgrade
endif
$(ENV):
$(shell which python$(PYTHON_VERSION)) -m venv $(ENV)
requirements.txt.done: $(ENV) requirements.txt
$(PYTHON) -m pip install --upgrade pip wheel setuptools
$(PYTHON) -m pip install -r requirements.txt
touch $@
build-frontend:
yarn
yarn build
develop: requirements.txt.done
$(PYTHON) -m manage migrate
make build-frontend
makemigrations: requirements.txt.done
$(PYTHON) -m manage makemigrations
run: requirements.txt.done
$(PYTHON) -m manage runserver
fix-codestyle: requirements.txt.done
$(BIN)/black apps
$(BIN)/isort apps
test: requirements.txt.done
$(PYTHON) -m pip check
$(PYTHON) -m pip_audit -r requirements/development.txt
$(PYTHON) -m pip_audit -r requirements/production.txt
$(BIN)/flake8 apps
$(PYTHON) -X dev -m pytest $(ARGS)
makemessages: requirements.txt.done
cd apps/frontend && ../$(PYTHON) ../manage.py makemessages
compilemessages: requirements.txt.done
cd apps/frontend && ../$(PYTHON) ../manage.py compilemessages
fixtures: requirements.txt.done
$(PYTHON) -m manage build_fixtures
deploy_prd:
$(BIN)/fab deploy prd
deploy_acc:
$(BIN)/fab deploy acc
clean:
rm -f requirements.txt.done
realclean: clean
rm -f -r $(ENV)
# Exit with error if git repo is dirty
.PHONY: test-repo-clean
test-repo-clean:
ifneq ($(GIT_STATUS), "")
@echo "Repo has new or modified files. Either commit them or add to .gitgnore."
@exit 1
endif
.PHONY: requirements
INFILES=production development deploy
requirements: $(ENV)
$(PYTHON) -m pip install --upgrade pip-tools
for INFILE in $(INFILES); do \
CUSTOM_COMPILE_COMMAND="make requirements" $(BIN)/pip-compile $(REQUIREMENTS_UPGRADE) --generate-hashes --output-file requirements/$${INFILE}.txt requirements/$${INFILE}.in; \
done