-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
150 lines (122 loc) · 3.83 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.DEFAULT_GOAL := help
.TESTS_DIR := tests
.REPORTS_DIR := coverage
.PACKAGE_NAME := waldiez_studio
.PACKAGE_MANAGER := bun
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Default target: help"
@echo ""
@echo "Targets:"
@echo " help Show this message and exit"
@echo " format-back Format the python code"
@echo " format-front Format the frontend code"
@echo " format Format the code"
@echo " lint-back Lint the python code"
@echo " lint-front Lint the frontend code"
@echo " lint Lint the code"
@echo " forlint Alias for 'make format && make lint'"
@echo " requirements Generate requirements/*.txt files"
@echo " test-back Run the tests for the backend"
@echo " test-front Run the tests for the frontend"
@echo " test Run the tests"
@echo " clean-back Remove unneeded files (__pycache__, .mypy_cache, etc.)"
@echo " clean-front Remove unneeded files (.stylelintcache, etc.)"
@echo " clean Remove unneeded files"
@echo " build-back Build the python package"
@echo " build-front Build the frontend package"
@echo " build Build the packages"
@echo " image Build the podman/docker image"
@echo " all-back Run format, lint, test and build for the backend"
@echo " all-front Run format, lint, test and build for the frontend"
@echo " all Run format, lint, test and build"
@echo " dev-back Run the development server"
@echo " dev-front Run the development server for the frontend"
@echo " dev Run the development server for the backend and frontend"
@echo ""
.PHONY: format-back
format-back:
isort .
autoflake --remove-all-unused-imports --remove-unused-variables --in-place .
black --config pyproject.toml .
ruff format --config pyproject.toml .
.PHONY: format-front
format-front:
${.PACKAGE_MANAGER} run format
.PHONY: format
format: format-back format-front
.PHONY: lint-back
lint-back:
isort --check-only .
black --check --config pyproject.toml .
mypy --config pyproject.toml .
flake8 --config=.flake8
pydocstyle --config pyproject.toml .
bandit -r -c pyproject.toml .
yamllint -c .yamllint.yaml .
ruff check --config pyproject.toml .
pylint --rcfile=pyproject.toml .
.PHONY: lint-front
lint-front:
${.PACKAGE_MANAGER} run lint
.PHONY: lint
lint: lint-back lint-front
.PHONY: forlint
forlint: format lint
.PHONY: clean-back
clean-back:
python scripts/clean.py
.PHONY: clean-front
clean-front:
${.PACKAGE_MANAGER} run clean
.PHONY: clean
clean: clean-back clean-front
.PHONY: requirements-back
requirements-back:
python scripts/requirements.py
.PHONY: requirements-front
requirements-front:
${.PACKAGE_MANAGER} run requirements
.PHONY: .before_test
.before_test:
python -c 'import os; os.makedirs(os.path.join("${.REPORTS_DIR}", "backend"), exist_ok=True)'
python -c \
'import subprocess, sys; subprocess.run(\
[sys.executable, "-m", "pip", "uninstall", "-y", "${.PACKAGE_NAME}"], \
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)'
.PHONY: test-back
test-back: .before_test
python scripts/test.py
.PHONY: test-front
test-front:
${.PACKAGE_MANAGER} run test:front
.PHONY: test
test: test-front test-back
.PHONY: build-front
build-front:
${.PACKAGE_MANAGER} run build
.PHONY: build-back
build-back:
python scripts/build.py
.PHONY: image
image:
python scripts/image.py
.PHONY: build
build: build-front build-back
.PHONY: all-back
all-back: clean-back format-back lint-back test-back build-back
.PHONY: all-front
all-front: clean-front format-front lint-front test-front build-front
.PHONY: all
all: all-front all-back
.PHONY: dev-back
dev-back:
python -m waldiez_studio --reload --log-level debug
.PHONY: dev-front
dev-front:
${.PACKAGE_MANAGER} run dev:front
.PHONY: dev
dev:
${.PACKAGE_MANAGER} run dev