-
Notifications
You must be signed in to change notification settings - Fork 111
/
Makefile
126 lines (89 loc) · 3.19 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
.PHONY: help
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-30s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clear:
@rm -rf build dist
build-wheel: ## build
rm -rf build dist
poetry build -f wheel
flake8: ## lint
poetry run flake8 playbase
mypy: ## mypy
poetry run mypy playbase
publish: ## publish package to pypi
poetry publish --build
test: ## test
docker-compose run --rm playbase-toolbox-test bash -c "python -m pytest tests"
test.verbose: ## test.verbose
docker-compose run --rm playbase-toolbox-test bash -c "python -m pytest tests -v --pdb --pdbcls=IPython.terminal.debugger:Pdb"
format: ## publish package to pypi
ruff format .
collectstatic:
docker-compose run --rm playbase-toolbox bash -c "djcli collectstatic"
shell_plus:
docker-compose run --rm playbase-toolbox bash -c "djcli shell_plus"
db.makemigrations:
docker-compose run --rm playbase-toolbox bash -c "djcli makemigrations"
db.migrate:
docker-compose run --rm playbase-toolbox bash -c "djcli migrate"
docker-build: ## build and compose up
docker-compose build && docker-compose up
docker-build-no-cache: ## build --no-cache
docker-compose build --no-cache && docker-compose up
start: ## runserver
docker-compose run --rm --service-ports playbase-web
beat: ## beat
docker compose up celerybeat
worker: ## worker
docker compose up celeryworker
flower: ## flower
docker compose up celeryflower
up: ## build and up
docker compose up
import-articles: ## Enter python manage.py
$(DJANGO_DOCKER_RUN) python manage.py import_hexo_source
sep--sep-b: ## ========== 测试与代码质量 ==============
echo "## ========== 本行只是优雅的分割线 ==============="
coverage: ## check code coverage quickly with the default Python
$(DJANGO_DOCKER_PATH_RUN) pytest tests/ --cov=playbase
release: clean ## package and upload a release
python setup.py sdist upload
python setup.py bdist_wheel upload
dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
install: clean ## install the package to the active Python's site-packages
python setup.py install
sep--sep-e: ## ========== Docker 镜像相关 ==============
echo "## ========== 本行只是优雅的分割线 ==============="
build-playbase: ## > playbase
docker build -t 'playbase:local' -f 'compose/app/Dockerfile' .
build-playbase-no-cache: ## > playbase
docker build -t 'playbase:local' -f 'compose/app/Dockerfile' --no-cache .
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/