-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
179 lines (137 loc) · 4.24 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
include $(ROOT_DIR)/tools/make/text.mk
include $(ROOT_DIR)/tools/make/help.mk
include $(ROOT_DIR)/tools/make/os.mk
include $(ROOT_DIR)/tools/make/git.mk
.DEFAULT_GOAL := help
# Executables
SF := symfony
SF_PROXY = $(shell $(SF) local:proxy:url)
SF_CONSOLE := $(SF) console
PHP := $(SF) php
COMPOSER := $(SF) composer
USER := $(shell id -u)
GROUP := $(shell id -g)
DC := USER_ID=$(USER) GROUP_ID=$(GROUP) $(shell docker compose --env-file /dev/null > /dev/null 2>&1 && echo 'docker compose --env-file /dev/null' || echo 'docker-compose --env-file /dev/null')
## Install everything needed to start the project
install:
$(SF) local:server:ca:install
$(MAKE) start
$(MAKE) app.install
## Start the environment
start:
$(SF) proxy:start
$(SF) serve
## Stop the environment
stop:
$(DC) kill
## Stop and delete the environment and project data (database, logs, etc.)
delete:
$(DC) down -v --remove-orphans
## App - Install the application
app.install:
@$(call action, Installing PHP dependencies...)
$(COMPOSER) install --prefer-dist
@$(call action, Running DB migrations...)
$(SF_CONSOLE) doctrine:migrations:migrate --no-interaction --all-or-nothing
## App - Install the application (alias to "make app.install")
app.update: app.install
######
# QA #
######
## QA - Run all QA checks
qa: archi refactor cs lint phpstan test
## QA - Run all QA checks and fix issues
qa.fix: archi refactor.fix cs.fix lint.fix phpstan test
#########
# Archi #
#########
## Architecture - Run architecture checks
archi: archi.back
## Architecture - Run architecture checks for backend
archi.back:
$(PHP) vendor/bin/deptrac --config-file=deptrac_layers.yaml --report-uncovered --fail-on-uncovered
$(PHP) vendor/bin/deptrac --config-file=deptrac_domains.yaml --report-uncovered --fail-on-uncovered
############
# Refactor #
############
## Refactor - Run all refactor checks
refactor: refactor.back
## Refactor - Run all refactor checks and fix issues
refactor.fix: refactor.back.fix
## Refactor - Run refactor checks for backend
refactor.back:
$(PHP) vendor/bin/rector process --dry-run
## Refactor - Run refactor checks for backend and fix issues
refactor.back.fix:
$(PHP) vendor/bin/rector process
################
# Coding style #
################
## Coding style - Run all coding style checks
cs: cs.back cs.front
## Coding style - Run all coding style checks and fix issues
cs.fix: cs.back.fix cs.front.fix
## Coding style - Check backend coding style
cs.back:
$(PHP) vendor/bin/ecs check
$(PHP) vendor/bin/twig-cs-fixer
## Coding style - Check backend coding style and fix issues
cs.back.fix:
$(PHP) vendor/bin/ecs check --fix
$(PHP) vendor/bin/twig-cs-fixer --fix
## Coding style - Check frontend coding style
cs.front:
ifdef CI
$(SF_CONSOLE) biomejs:ci . --linter-enabled=false
else
$(SF_CONSOLE) biomejs:check . --linter-enabled=false
endif
## Coding style - Check frontend coding style and fix issues
cs.front.fix:
$(SF_CONSOLE) biomejs:check . --linter-enabled=false --write --unsafe
##########
# Linter #
##########
## Linter - Run all linters
lint: lint.back lint.front
## Linter - Run all linters and fix issues
lint.fix: lint.back lint.front.fix
## Linter - Run linters for backend
lint.back:
$(SF_CONSOLE) lint:container
$(SF_CONSOLE) lint:xliff translations
$(SF_CONSOLE) lint:yaml --parse-tags config
$(SF_CONSOLE) lint:twig templates
#$(SF_CONSOLE) doctrine:schema:validate
## Linter - Lint front files
lint.front:
ifdef CI
$(SF_CONSOLE) biomejs:ci . --formatter-enabled=false
else
$(SF_CONSOLE) biomejs:check . --formatter-enabled=false
endif
## Linter - Lint front files and fix issues
lint.front.fix:
$(SF_CONSOLE) biomejs:check . --formatter-enabled=false --write --unsafe
###########
# PHPStan #
###########
## PHPStan - Run PHPStan
phpstan:
$(PHP) vendor/bin/phpstan analyse
## PHPStan - Run PHPStan and update the baseline
phpstan.generate-baseline:
$(PHP) vendor/bin/phpstan analyse --generate-baseline
#########
# Tests #
#########
## Tests - Run all tests
test: test.back
## Tests - Run backend tests
test.back:
$(PHP) vendor/bin/phpunit
## Tests - Run backend tests with coverage
test.back.coverage:
$(PHP) vendor/bin/phpunit --coverage-html .cache/phpunit/coverage-html
-include $(ROOT_DIR)/Makefile.local