forked from MrThearMan/graphene-django-query-optimizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
101 lines (76 loc) · 2.26 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
export DJANGO_SETTINGS_MODULE = example_project.config.settings
.PHONY: Makefile
.PHONY: create-user
.PHONY: dev
.PHONY: docs
.PHONY: flush
.PHONY: generate
.PHONY: help
.PHONY: hook
.PHONY: lint
.PHONY: migrate
.PHONY: migrations
.PHONY: mypy
.PHONY: profile
.PHONY: setup
.PHONY: test
.PHONY: tests
.PHONY: tox
# Trick to allow passing commands to make
# Use quotes (" ") if command contains flags (-h / --help)
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`
# If command doesn't match, do not throw error
%:
@:
define helptext
Commands:
create-user Create a superuser called "x" with password of "x"
dev Serve manual testing server
docs Serve mkdocs for development.
flush Flush database.
generate Generate test data.
hook Install pre-commit hook.
lint Run pre-commit hooks on all files.
migrate Migrate database.
migrations Make migrations.
mypy Run mypy on all files.
profile <pid> Run py-spy for a given PID.
setup Make migrations, apply them, and add a superuser
test <name> Run all tests maching the given <name>
tests Run all tests with coverage.
tox Run all tests with tox.
Use quotes (" ") if command contains flags (-h / --help)
endef
export helptext
help:
@echo "$$helptext"
create-user:
@DJANGO_SUPERUSER_PASSWORD=x poetry run python manage.py createsuperuser --username x --email [email protected] --no-input
dev:
@poetry run python manage.py runserver localhost:8000
docs:
@poetry run mkdocs serve -a localhost:8080
flush:
@poetry run python manage.py flush --no-input
generate:
@poetry run python manage.py create_test_data
hook:
@poetry run pre-commit install
lint:
@poetry run pre-commit run --all-files
migrate:
@poetry run python manage.py migrate
migrations:
@poetry run python manage.py makemigrations
mypy:
@poetry run mypy query_optimizer/
profile:
@poetry run py-spy record -o profile.svg --pid $(call args, "")
setup: migrations migrate create-user
test:
@poetry run pytest -k $(call args, "")
tests:
@poetry run coverage run -m pytest
@poetry run coverage report -m
tox:
@poetry run tox