-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
90 lines (61 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
SRC_DIR = src
JS_DIR = $(SRC_DIR)/js
PHP_DIR = $(SRC_DIR)/php
PY_DIR = $(SRC_DIR)/python
PY_ENV = $(PY_DIR)/venv
JS_DEPS = $(JS_DIR)/node_modules
PHP_VENDOR = $(PHP_DIR)/vendor
BOLD = \x1b[1m
RESET = \x1b[0m
# Prettify the output when lolcat is installed
_CAN_PRETTY := $(shell command -v lolcat)
ifeq (, $(_CAN_PRETTY))
COLOR =
else
COLOR = |lolcat
endif
all: fclean deps
# - Deps ---------------------------------------------------------------------------------------------------------------
$(PY_ENV):
@ python -m venv $@
@ chmod +x $@/bin/activate
@ ./$@/bin/activate
@ $@/bin/pip3 install -r $(PY_DIR)/requirements.txt
$(JS_DEPS):
@ yarn install --cwd $(JS_DIR)
$(PHP_VENDOR):
@ composer install -d $(PHP_DIR)
deps: $(PHP_VENDOR) $(JS_DEPS) $(PY_ENV)
@ echo -e "$(BOLD)* All dependencies were installed$(RESET)" $(COLOR)
# - Readme -------------------------------------------------------------------------------------------------------------
docs/readme.md:
@ python -m scripts.auto_update_readme
@ echo -e "$(BOLD)* Generated new readme.md$(RESET)" $(COLOR)
# - Tests --------------------------------------------------------------------------------------------------------------
js_test: $(JS_DEPS)
@ yarn --cwd $(JS_DIR) test --coverage
php_test: $(PHP_VENDOR)
@ XDEBUG_MODE=coverage $(PHP_VENDOR)/bin/phpunit --coverage-clover $(PHP_DIR)/coverage.xml -c $(PHP_DIR)/phpunit.xml
py_test: $(PY_ENV)
@ $(PY_ENV)/bin/pytest -n 2 $(PY_DIR)/katas/*/*.py $(PY_DIR)/katas/test_* --cov=$(PY_DIR)
@ $(PY_ENV)/bin/python -m coverage xml -o $(PY_DIR)/coverage.xml
cov: clean js_test php_test py_test
# - Cleaning -----------------------------------------------------------------------------------------------------------
clean:
@ rm -rf coverage.xml
@ rm -rf htmlcov
@ rm -rf $(JS_DIR)/coverage
@ rm -rf .coverage
@ rm -rf $(PHP_DIR)/coverage.xml
@ rm -rf $(PHP_DIR)/.phpunit.result.cache
@ rm -rf $(PHP_DIR)/.phpunit.cache
@ rm -rf $(PY_DIR)/katas/*/.pytest_cache
@ rm -rf .pytest_cache
@ rm -rf .mypy_cache
@ echo -e "$(BOLD)* cache cleaned up$(RESET)" $(COLOR)
fclean: clean
@ rm -rf $(JS_DEPS)
@ rm -rf $(PY_ENV)
@ rm -rf $(PHP_DIR)/vendor
@ echo -e "$(BOLD)* full clean done$(RESET)" $(COLOR)
.PHONY: PY_DEPS js_test php_test py_test fclean deps cov