forked from vsdudakov/fastadmin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
88 lines (75 loc) · 2.28 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
.PHONY: clean
clean:
@exec find . -type d -name "__pycache__" -exec rm -rf {} + > /dev/null 2>&1
@exec find . -type f -name "*.pyc" -exec rm -rf {} + > /dev/null 2>&1
@exec rm -rf htmlcov
@exec rm -rf .coverage
.PHONY: fix
fix:
@echo "Run ruff"
@exec poetry run ruff --fix fastadmin tests examples docs
@echo "Run isort"
@exec poetry run isort fastadmin tests examples docs
@echo "Run black"
@exec poetry run black fastadmin tests examples docs
@echo "Run mypy"
@exec poetry run mypy -p fastadmin -p tests -p examples -p docs
@echo "Run frontend linters"
@exec make -C frontend fix
.PHONY: lint
lint:
@echo "Run ruff"
@exec poetry run ruff fastadmin tests examples docs
@echo "Run isort"
@exec poetry run isort --check-only fastadmin tests examples docs
@echo "Run black"
@exec poetry run black --check --diff fastadmin tests examples docs
@echo "Run mypy"
@exec poetry run mypy -p fastadmin -p tests -p examples -p docs
@echo "Run frontend linters"
@exec make -C frontend lint
.PHONY: test
test:
@exec poetry run python generate_db.py
@exec env ADMIN_ENV_FILE=example.env poetry run pytest --cov=fastadmin --cov-report=term-missing --cov-report=xml --cov-fail-under=90 -s tests
@exec make -C frontend test
.PHONY: kill
kill:
@exec kill -9 $$(lsof -t -i:8090)
@exec kill -9 $$(lsof -t -i:3030)
.PHONY: collectstatic
collectstatic:
@exec rm -rf ./fastadmin/static/js
@exec rm -rf ./fastadmin/static/css
@exec cp -rf ./frontend/build/static/js/ ./fastadmin/static/js/
@exec cp -rf ./frontend/build/static/css/ ./fastadmin/static/css/
@exec mv fastadmin/static/js/main*.js fastadmin/static/js/main.min.js
@exec mv fastadmin/static/css/main*.css fastadmin/static/css/main.min.css
@exec rm fastadmin/static/js/*.txt
.PHONY: install
install:
@exec poetry install --all-extras
@exec make -C frontend install
.PHONY: docs
docs:
@exec make -C docs build
.PHONY: build
build:
@exec make docs
@exec make -C frontend build
@exec make collectstatic
.PHONY: pre-commit-install
pre-commit-install:
@exec poetry run pip install pre-commit
@exec poetry run pre-commit install
.PHONY: pre-commit
pre-commit:
@exec poetry run pre-commit run --all-files
.PHONY: push
pre-push:
@exec make fix
@exec make lint
@exec make pre-commit-install
@exec make pre-commit
@exec make docs
@exec make build