-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
75 lines (50 loc) · 2.04 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
# --- constants ----------------------------------------------------------------
static_folder_name = .static
path_to_task_dummy_data = ./dummy_data
# --- shortcuts ----------------------------------------------------------------
ci: local-ci
dev: build server
build: reset statics dummy-data
# --- dummy data ---------------------------------------------------------------
dummy-data:
poetry run python dummy_data/make_random_tasks.py
# --- CI -----------------------------------------------------------------------
local-ci: refactor lint tests
refactor:
poetry run ruff --fix
lint:
poetry run ruff check
poetry run mypy --strict business_logic
poetry run mypy --strict web_interface
poetry run mypy --strict server
tests:
poetry run pytest business_logic --noconftest
.PHONY: server
server:
STATIC_FOLDER_NAME=$(static_folder_name) \
PATH_TO_TASK_DUMMY_DATA=$(path_to_task_dummy_data) \
poetry run uvicorn server.__main__:app --reload
# --- make static web interface html, css and js files -------------------------
statics: all-css-files all-js-files all-data-files all-images
$(static_folder_name):
mkdir $(static_folder_name)
all-css-files: $(static_folder_name)
cp web_interface/private/__css_components__/* $(static_folder_name)/
all-js-files: $(static_folder_name)
cp web_interface/private/__js_files__/* $(static_folder_name)/
all-images: $(static_folder_name)
cp web_interface/private/__images__/* $(static_folder_name)/
all-data-files: $(static_folder_name)
cp web_interface/private/__data_files__/* $(static_folder_name)/
# --- reset repo ---------------------------------------------------------------
reset: reset-statics
reset-statics:
rm -rf $(static_folder_name)
# --- functions ----------------------------------------------------------------
# "build" will run the given 1 and pipe the stdout of 1 into 2 if 1 finishes without errors
# this prevents the building of empty html files in the static folder, when errors occur
define build
@echo "$(strip $(1)) > $(strip $(2))"
@out=$$($(1)) && \
echo "$$out" > $(2)
endef