-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
93 lines (72 loc) · 1.87 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
# Executables (on local machine)
DOCKER_COMP = docker compose
# Docker containers
PHP_CONT = $(DOCKER_COMP) exec php
# Executables (inside containers)
PHP = $(PHP_CONT) php
COMPOSER = $(PHP_CONT) composer
SYMFONY = $(PHP) bin/console
# Colors
COLOR_RESET = \033[0m
COLOR_TARGET = \033[32m
COLOR_TITLE = \033[33m
TEXT_BOLD = \033[1m
.PHONY: help
.SILENT: help
help:
printf "\n${COLOR_TITLE}Usage:${COLOR_RESET}\n"
printf " ${COLOR_TARGET}make${COLOR_RESET} [target]\n"
printf "\n"
awk '/^[\w\.@%-]+:/i { \
helpMessage = match(lastLine, /^### (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":") - 1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_TARGET}%-30s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
/^##@.+/ { \
printf "\n${TEXT_BOLD}${COLOR_TITLE}%s${COLOR_RESET}\n", substr($$0, 5); \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
##@ Init
### Install the dependencies
install:
$(PHP_CONT) composer install
##@ Docker
### Build the Docker images
docker-build:
$(DOCKER_COMP) build --no-cache
### Start the docker hub in detached mode (no logs)
docker-start:
$(DOCKER_COMP) up --pull always -d --wait
### Stop the docker hub
docker-stop:
$(DOCKER_COMP) down --remove-orphans
### Log into the PHP container
docker-sh:
$(PHP_CONT) bash
##@ Frontend
### Start the frontend build watch
front-watch:
$(SYMFONY) tailwind:build --watch
### Build the frontend assets
front-build:
$(SYMFONY) tailwind:build --minify
$(SYMFONY) asset-map:compile
##@ Code Quality
### Run test suite
qa-test: public/assets
$(PHP) bin/phpunit
### Run PHPStan
qa-phpstan:
$(PHP) vendor/bin/phpstan
### Run PHP-CS-Fixer (dry-run)
qa-cs:
$(PHP) vendor/bin/php-cs-fixer fix --dry-run --diff
### Run PHP-CS-Fixer (fix)
qa-cs-fix:
$(PHP) vendor/bin/php-cs-fixer fix
## Hidden targets
public/assets:
make front-build