-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·95 lines (71 loc) · 2.89 KB
/
Makefile
File metadata and controls
executable file
·95 lines (71 loc) · 2.89 KB
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
################### list ###################
list: # display this list
@cat Makefile \
| grep "^[a-z0-9_]\+:" \
| sed -r "s/:[^#]*?#?(.*)?/\r\t\t\t\t-\1/" \
| sed "s/^/ • make /" \
| sort
################### Colors ###################
GREEN=\033[0;32m
RED=\033[0;31m
BLUE=\033[0;34m
END_COLORING=\033[0m
################### Variables ###################
BIN=vendor/bin/
MND=$(BIN)phpmnd
STAN=$(BIN)phpstan
PHP=$(BIN)php
UNIT=$(BIN)phpunit
METRICS=$(BIN)phpmetrics
CBF=$(BIN)phpcbf
SRC=./src
TESTS=./tests
CONTAINER_NAME = php8-hexa
DOCKER_EXEC_TOOLS_APP=docker exec -it $(CONTAINER_NAME) sh
COMPOSE_FILE = docker-compose.yml
##################### Php ######################
################### Composer ###################
ci: # composer install dev|staging
CMD=install docker compose -f $(COMPOSE_FILE) up composer
@echo "$(GREEN)Done starting for $(COMPOSE_FILE) composer install$(END_COLORING)"
cu: # composer update dev|staging
CMD=update docker compose -f $(COMPOSE_FILE) up composer
@echo "$(GREEN)Done starting for $(COMPOSE_FILE) composer update$(END_COLORING)"
ca: # composer dump-autoload dev|staging
CMD=dump-autoload docker compose -f $(COMPOSE_FILE) up composer
@echo "$(GREEN)Done starting for $(COMPOSE_FILE) composer dump-autoload$(END_COLORING)"
################### Dev-Work ###################
dev: # starting contain and tests for start working
make cu
make php
make test
@echo "$(GREEN)You're all set and ready to dev$(END_COLORING)"
################## Php helper ###################
analyze: # mnd + stan
docker exec $(CONTAINER_NAME) $(MND) ./src --progress --extensions=default_parameter,-return,argument
docker exec $(CONTAINER_NAME) $(STAN) analyse -c ./tools/phpstan.neon --memory-limit 1G
@echo "$(GREEN)Done static analysis$(END_COLORING)"
report: # phpMetrics report to e.g. http://localhost:63342/hexa/tools/reports/23-12-29_09-59-53/index.html
docker exec $(CONTAINER_NAME) $(METRICS) --report-html=./tools/reports/`date +'%y-%m-%d_%H-%M-%S'` ./
@echo "$(GREEN)Done metrics report$(END_COLORING)"
cs: # sniffer + beautifier
docker exec $(CONTAINER_NAME) $(CBF) --standard=./tools/sniffs.xml ./src
docker exec $(CONTAINER_NAME) $(CBF) --standard=./tools/sniffs.xml ./tests
@echo "$(GREEN)Done cleaning$(END_COLORING)"
################## docker dev ##################
pbu: # building php container
docker compose build $(CONTAINER_NAME)
@echo "$(GREEN)Done building php$(END_COLORING)"
pup: # starting php container
docker compose up $(CONTAINER_NAME) -d
@echo "$(GREEN)Done starting php$(END_COLORING)"
php: # build and start php and database container
make pbu
make pup
@echo "$(GREEN)Done building and starting php and database$(END_COLORING)"
test: # run unit & integration tests
make pup
docker exec $(CONTAINER_NAME) $(UNIT) --configuration=./tools/phpunit.xml --testsuite "unit, integration"
init: # init the container
make php
make ci