-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (76 loc) · 2.13 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
include .env
export $(shell sed 's/=.*//' .env)
SHELL := /bin/sh
PROJECTNAME ?= default_app_name
APP_NAME := $(PROJECTNAME)
BACKEND_APP_NAME := $(APP_NAME)-backend
export project_name=$(PROJECTNAME)
export backend_app_name=$(BACKEND_APP_NAME)
export app_name=$(APP_NAME)
define HELP
Manage $(PROJECTNAME). Usage:
make lint Run linter
make format Run formatter
make test Run tests
make coverage Run coverage
make coverage-report Generate coverage report
make super-user Create super user
make make-migrations Make migrations
make make-migrate Migrate
make build-dev Build and run dev environment
make stop-dev Stop dev environment
make stop-prod Stop prod environment
make build-prod Build and run prod environment
make all Show help
endef
export HELP
.PHONY: help
help:
@echo "$$HELP"
.PHONY: lint
lint:
@bash ./scripts/lint.sh
.PHONY: format
format:
@bash ./scripts/format.sh
.PHONY: test
test:
@bash ./scripts/test.sh
.PHONY: coverage
coverage:
docker exec -it $(BACKEND_APP_NAME) sh "-c" \
"coverage run ./manage.py test"
.PHONY: coverage-report
coverage-report:
docker exec -it $(BACKEND_APP_NAME) sh "-c" \
"coverage run ./manage.py test && coverage report -m"
.PHONY: super-user
super-user:
docker exec -it $(BACKEND_APP_NAME) sh "-c" \
"python manage.py createsuperuser"
.PHONY: make-migrations
make-migrations:
docker exec -it $(BACKEND_APP_NAME) $(SHELL) "-c" \
"python manage.py makemigrations"
.PHONY: loaddata
loaddata:
docker exec -it $(BACKEND_APP_NAME) $(SHELL) "-c" \
"python manage.py loaddata fixtures/*.json"
.PHONY: make-migrate
make-migrate:
docker exec -it $(BACKEND_APP_NAME) $(SHELL) "-c" \
"python manage.py migrate"
.PHONY: build-dev
build-dev:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.yml up --build -d
.PHONY: build-prod
build-prod:
DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker-compose -f docker-compose.yml up --build -d
.PHONY: stop-dev
stop-dev:
@docker-compose -f docker-compose.yml down
.PHONY: stop-prod
stop-prod:
@docker-compose -f docker-compose.yml down
.PHONY: all
all: help