-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathTaskfile.yaml
303 lines (250 loc) · 6.41 KB
/
Taskfile.yaml
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# https://taskfile.dev
version: '3'
silent: true
vars:
GREETING: "Hello, Welcome to Symfony And Docker Taskfile !"
PWD: $PWD
DOCKER: docker
DOCKER_RUN: "{{.DOCKER}} run"
DOCKER_COMPOSE: docker compose
DOCKER_COMPOSE_UP: "{{.DOCKER_COMPOSE}} up"
DOCKER_COMPOSE_STOP: "{{.DOCKER_COMPOSE}} stop"
SYMFONY: symfony
SYMFONY_SERVER_START: "{{.SYMFONY}} server:start"
SYMFONY_SERVER_STOP: "{{.SYMFONY}} server:stop"
SYMFONY_CONSOLE: "{{.SYMFONY}} console"
SYMFONY_LINT: "{{.SYMFONY_CONSOLE}} lint:"
COMPOSER: composer
COMPOSER_INSTALL: "{{.COMPOSER}} install"
COMPOSER_UPDATE: "{{.COMPOSER}} update"
NPM: npm
NPM_INSTALL: "{{.NPM}} install --force"
NPM_UPDATE: "{{.NPM}} update"
NPM_BUILD: "{{.NPM}} run build"
NPM_DEV: "{{.NPM}} run dev"
NPM_WATCH: "{{.NPM}} run watch"
PHPQA: jakzal/phpqa
PHPQA_RUN: "{{.DOCKER_RUN}} --init -it --rm -v {{.PWD}}:/project -w /project {{.PHPQA}}"
PHPUNIT: "APP_ENV=test {{.SYMFONY}} php bin/phpunit"
tasks:
default:
cmds:
- task: help
help:
desc: Display this help
cmds:
- echo "{{.GREETING}}"
- task --list
docker-up:
desc: "Start docker containers"
cmds:
- "{{.DOCKER_COMPOSE_UP}}"
docker-stop:
desc: "Stop docker containers"
cmds:
- "{{.DOCKER_COMPOSE_STOP}}"
sf-start:
desc: "Start symfony server"
cmds:
- "{{.SYMFONY_SERVER_START}}"
sf-stop:
desc: "Stop symfony server"
cmds:
- "{{.SYMFONY_SERVER_STOP}}"
sf-cc:
desc: "Clear symfony cache"
cmds:
- "{{.SYMFONY_CONSOLE}} cache:clear"
sf-log:
desc: "Display symfony logs"
cmds:
- "{{.SYMFONY_CONSOLE}} server:log"
sf-dc:
desc: "Create symfony database"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:database:create --if-not-exists"
sf-dd:
desc: "Drop symfony database"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:database:drop --if-exists --force"
sf-dc:
desc: "Update symfony schema database"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:schema:update --force"
sf-mm:
desc: "Make symfony migration"
cmds:
- "{{.SYMFONY_CONSOLE}} make:migration"
sf-dmm:
desc: "Migrate"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:migrations:migrate --no-interaction"
sf-fixtures:
desc: "Load fixtures"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:fixtures:load --no-interaction"
sf-me:
desc: "Make entity"
cmds:
- "{{.SYMFONY_CONSOLE}} make:entity"
sf-mc:
desc: "Make controller"
cmds:
- "{{.SYMFONY_CONSOLE}} make:controller"
sf-mf:
desc: "Make form"
cmds:
- "{{.SYMFONY_CONSOLE}} make:form"
sf-perm:
desc: "Fix permissions"
cmds:
- "chmod -R 777 var"
sf-sudo-perm:
desc: "Fix permissions with sudo"
cmds:
- "sudo chmod -R 777 var"
sf-dump-env:
desc: "Dump env"
cmds:
- "{{.SYMFONY_CONSOLE}} debug:dotenv"
sf-dump-env-container:
desc: "Dump env container"
cmds:
- "{{.SYMFONY_CONSOLE}} debug:container --env-vars"
sf-dump-router:
desc: "Dump routes"
cmds:
- "{{.SYMFONY_CONSOLE}} debug:router"
sf-open:
desc: "Open symfony server"
cmds:
- "{{.SYMFONY}} open:local"
sf-check-requirements:
desc: "Check symfony requirements"
cmds:
- "{{.SYMFONY}} check:requirements"
composer-install:
desc: "Install composer dependencies"
cmds:
- "{{.COMPOSER_INSTALL}}"
composer-update:
desc: "Update composer dependencies"
cmds:
- "{{.COMPOSER_UPDATE}}"
composer-validate:
desc: Validate composer.json file.
cmds:
- "{{.COMPOSER}} validate"
composer-validate-deep:
desc: Validate composer.json and composer.lock files in strict mode.
cmds:
- "{{.COMPOSER}} validate --strict --check-lock"
npm-install:
desc: "Install npm dependencies"
cmds:
- "{{.NPM_INSTALL}}"
npm-update:
desc: "Update npm dependencies"
cmds:
- "{{.NPM_UPDATE}}"
npm-build:
desc: "Build assets"
cmds:
- "{{.NPM_BUILD}}"
npm-dev:
desc: "Build assets in dev mode"
cmds:
- "{{.NPM_DEV}}"
npm-watch:
desc: "Watch assets"
cmds:
- "{{.NPM_WATCH}}"
qa-cs-fixer-dry-run:
desc: "Run php-cs-fixer dry run"
cmds:
- "{{.PHPQA_RUN}} php-cs-fixer fix ./src --rules=@Symfony --verbose --dry-run"
qa-cs-fixer:
desc: "Run php-cs-fixer"
cmds:
- "{{.PHPQA_RUN}} php-cs-fixer fix ./src --rules=@Symfony --verbose"
qa-phpstan:
desc: "Run phpstan"
cmds:
- "{{.PHPQA_RUN}} phpstan analyse ./src --level=7"
qa-security-checker:
desc: "Run security-checker"
cmds:
- "{{.SYMFONY}} security:check"
qa-phpcpd:
desc: "Run phpcpd (copy/paste detector)"
cmds:
- "{{.PHPQA_RUN}} phpcpd ./src"
qa-php-metrics:
desc: "Run php-metrics"
cmds:
- "{{.PHPQA_RUN}} phpmetrics --report-html=var/phpmetrics ./src"
qa-lint-twigs:
desc: "Run lint:twig"
cmds:
- "{{.SYMFONY_LINT}}twig ./templates"
qa-lint-yaml:
desc: "Run lint:yaml"
cmds:
- "{{.SYMFONY_LINT}}yaml ./config"
qa-lint-container:
desc: "Run lint:container"
cmds:
- "{{.SYMFONY_LINT}}container"
qa-lint-schema:
desc: "Lint Doctrine schema"
cmds:
- "{{.SYMFONY_CONSOLE}} doctrine:schema:validate --skip-sync -vvv --no-interaction"
tests:
desc: "Run tests"
cmds:
- "{{.PHPUNIT}} --testdox"
tests-coverage:
desc: "Run tests with coverage"
cmds:
- "{{.PHPUNIT}} --coverage-html var/coverage"
before-commit:
desc: "Run before commit"
cmds:
- task: qa-cs-fixer
- task: qa-phpstan
- task: qa-security-checker
- task: qa-phpcpd
- task: qa-lint-twigs
- task: qa-lint-yaml
- task: qa-lint-container
- task: qa-lint-schema
- task: tests
first-install:
desc: "First install"
cmds:
- task: docker-up
- task: composer-install
- task: npm-install
- task: npm-build
- task: sf-perm
- task: sf-dc
- task: sf-dmm
- task: sf-start
- task: sf-open
start:
desc: "Start"
cmds:
- tasl: docker-up
- task: sf-start
- task: sf-open
stop:
desc: "Stop"
cmds:
- task: sf-stop
- task: docker-stop
reset-db:
desc: "Reset database"
cmds:
- task: sf-dd
- task: sf-dc
- task: sf-dmm