-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
425 lines (363 loc) · 14.6 KB
/
Taskfile.yml
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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
version: '3'
tasks:
########
# MAIN #
########
install:
desc: Install Sea of Bottle Project
cmds:
- task: frontend-dependencies
- task: api-dependencies
- task: api-event-store-create
- task: api-event-store-migration
- task: api-event-store-fixture
- task: api-event-store-create-test
- task: api-event-store-migration-test
- task: api-relational-database-create
- task: api-relational-database-migration
- task: api-relational-database-fixture
- task: api-relational-database-create-test
- task: api-relational-database-migration-test
check:
desc: Check and fix sources
cmds:
- task: lint
- task: global-commit-linter-check
- task: global-yaml-linter-check
- task: global-markdown-linter-check
- task: frontend-html-linter-check
- task: api-static-analysis
- task: api-layers-check
- task: test
- task: api-relational-database-schema-check
- task: api-transitive-dependencies-check
serve:
desc: Start a local development stack
cmds:
- docker-compose up -d frontend-webserver
deps:
- frontend-dependencies
- api-dependencies
test:
desc: Launch tests suites
cmds:
- task: api-event-store-create-test
- task: api-event-store-migration-test
- task: api-relational-database-create-test
- task: api-relational-database-migration-test
- task: api-unit-test
- task: api-integration-test
- task: frontend-unit-test
- task: frontend-e2e-test
lint:
desc: Lint sources
cmds:
- task: global-markdown-linter
- task: api-php-linter
- task: frontend-sass-linter
- task: frontend-ts-linter
update:
desc: Update dependencies
cmds:
- task: api-dependencies-update
- task: frontend-dependencies-update
##########
# GLOBAL #
##########
global-yaml-linter-check:
desc: Check linter rules to YAML files
cmds:
- docker-compose run --rm yaml-linter yamllint -c .yamllint.yaml .
global-markdown-linter:
desc: Apply linter rules to markdown files
cmds:
- docker-compose run --rm markdown-linter markdownlint '**/*.md' -c .markdownlint.yaml --ignore api/vendor --ignore api/dist --ignore frontend/node_modules --ignore frontend/dist --fix
global-markdown-linter-check:
desc: Check linter rules to markdown files
cmds:
- docker-compose run --rm markdown-linter markdownlint '**/*.md' -c .markdownlint.yaml --ignore api/vendor --ignore api/dist --ignore frontend/node_modules --ignore frontend/dist
global-commit-linter-check:
desc: Checks if commit messages meet the conventional commit format
cmds:
- docker-compose run --rm commit-linter commitlint --from $(git rev-list --max-parents=0 HEAD)
#######
# API #
#######
api-dependencies:
desc: Install API dependencies
cmds:
- docker-compose run --rm --no-deps api-cli composer install
sources:
- api/composer.lock
generates:
- api/vendor/**/*
method: checksum
api-dependencies-update:
desc: Update API dependencies
cmds:
- docker-compose run --rm --no-deps api-cli composer update
api-event-store-create:
desc: Create/Recreate API eventstore
cmds:
- docker-compose run --rm api-cli bin/console doctrine:database:drop --force --if-exists --connection=event_store
- docker-compose run --rm api-cli bin/console doctrine:database:create --connection=event_store
deps:
- api-dependencies
api-relational-database-create:
desc: Create/Recreate API database
cmds:
- docker-compose run --rm api-cli bin/console doctrine:database:drop --force --if-exists --connection=relational_model
- docker-compose run --rm api-cli bin/console doctrine:database:create --connection=relational_model
deps:
- api-dependencies
api-event-store-create-test:
desc: Create/Recreate API eventstore for test suites
cmds:
- docker-compose run --rm api-cli bin/console doctrine:database:drop --force --if-exists --connection=event_store --env=test
- docker-compose run --rm api-cli bin/console doctrine:database:create --connection=event_store --env=test
deps:
- api-dependencies
api-relational-database-create-test:
desc: Create/Recreate API database for test suites
cmds:
- docker-compose run --rm api-cli bin/console doctrine:database:drop --force --if-exists --connection=relational_model --env=test
- docker-compose run --rm api-cli bin/console doctrine:database:create --connection=relational_model --env=test
deps:
- api-dependencies
api-event-store-migration:
desc: Execute API eventstore migrations
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:migrate --configuration=src/Infrastructure/Persistence/EventStore/Migration/doctrine_migrations.yaml --no-interaction
deps:
- api-dependencies
api-relational-database-migration:
desc: Execute API database migrations
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:migrate --configuration=src/Infrastructure/Persistence/RelationalModel/Migration/doctrine_migrations.yaml --no-interaction
deps:
- api-dependencies
api-event-store-migration-test:
desc: Execute API eventstore migrations for test suites
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:migrate --configuration=src/Infrastructure/Persistence/EventStore/Migration/doctrine_migrations.yaml --no-interaction --env=test
deps:
- api-dependencies
api-relational-database-migration-test:
desc: Execute API database migrations for test suites
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:migrate --configuration=src/Infrastructure/Persistence/RelationalModel/Migration/doctrine_migrations.yaml --no-interaction --env=test
deps:
- api-dependencies
api-event-store-migration-diff:
desc: Generate API eventstore migrations
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:diff --configuration=src/Infrastructure/Persistence/EventStore/Migration/doctrine_migrations.yaml --em=event_store --no-interaction
deps:
- api-dependencies
api-relational-database-migration-diff:
desc: Generate API database migrations
cmds:
- docker-compose run --rm api-cli bin/console doctrine:migration:diff --configuration=src/Infrastructure/Persistence/RelationalModel/Migration/doctrine_migrations.yaml --em=relational_model --no-interaction
deps:
- api-dependencies
api-event-store-fixture:
desc: Generate API eventstore fixtures
cmds:
- docker-compose run --rm api-cli bin/console hautelook:fixtures:load --manager=event_store --append --no-interaction
deps:
- api-dependencies
api-relational-database-fixture:
desc: Generate API database fixtures
cmds:
- docker-compose run --rm api-cli bin/console hautelook:fixtures:load --manager=relational_model --append --no-interaction
deps:
- api-dependencies
api-relational-database-schema-check:
desc: Check if there is a difference between API database and ORM data mapping
cmds:
- docker-compose run --rm api-cli bin/console doctrine:schema:validate --env=test --em=relational_model
deps:
- api-dependencies
api-php-linter:
desc: Apply API linter rules to PHP sources
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/php-cs-fixer fix -v --show-progress=dots
deps:
- api-dependencies
api-php-linter-check:
desc: Check API linter rules to PHP sources
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/php-cs-fixer fix -v --show-progress=dots --dry-run
deps:
- api-dependencies
api-static-analysis:
desc: Check API PHP sources with phpstan
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/phpstan analyse
deps:
- api-dependencies
api-transitive-dependencies-check:
desc: Analyse API composer dependencies and verify that no unknown symbols are used in the sources of a package
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
deps:
- api-dependencies
api-layers-check:
desc: Check dependencies between API layers with deptrac
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/deptrac analyze
deps:
- api-dependencies
api-dependencies-security-check:
desc: Check API dependencies known security vulnerabilities
cmds:
- docker-compose run --rm --no-deps api-cli symfony security:check
api-unit-test:
desc: Execute API unit test suites
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/phpunit --group unit
deps:
- api-dependencies
api-integration-test:
desc: Execute API integration test suites
cmds:
- docker-compose run --rm --no-deps api-cli vendor/bin/phpunit --group integration
deps:
- api-dependencies
############
# FRONTEND #
############
frontend-dependencies:
desc: Install frontend dependencies
cmds:
- docker-compose run --rm --no-deps frontend-cli npm ci
sources:
- frontend/package-lock.json
generates:
- frontend/node_modules/**/*
method: checksum
frontend-dependencies-update:
desc: Update frontend dependencies
cmds:
- docker-compose run --rm --no-deps frontend-cli npm update
frontend-e2e-test:
desc: Execute frontend end to end test suites
cmds:
- docker-compose run --rm cypress
frontend-unit-test:
desc: Execute frontend unit test suites
cmds:
- docker-compose run --rm --no-deps frontend-cli npx ng test --code-coverage --watch=false
deps:
- frontend-dependencies
frontend-dependencies-audit:
desc: Execute frontend NPM security audit
cmds:
- docker-compose run --rm --no-deps frontend-cli npm audit --production
deps:
- frontend-dependencies
frontend-dependencies-audit-fix:
desc: Resolve frontend NPM security vulnerabilities
cmds:
- docker-compose run --rm --no-deps frontend-cli npm audit fix
deps:
- frontend-dependencies
frontend-sass-linter:
desc: Apply frontend linter rules to SASS sources
cmds:
- docker-compose run --rm --no-deps frontend-cli npx stylelint 'src/**/*.scss' --fix
deps:
- frontend-dependencies
frontend-sass-linter-check:
desc: Check frontend linter rules to SASS sources
cmds:
- docker-compose run --rm --no-deps frontend-cli npx stylelint 'src/**/*.scss'
deps:
- frontend-dependencies
frontend-ts-linter:
desc: Apply frontend linter rules to Typescript sources
cmds:
- docker-compose run --rm --no-deps frontend-cli npx eslint '{src/**/*.{ts,html},e2e/**/*.ts}' --fix
deps:
- frontend-dependencies
frontend-ts-linter-check:
desc: Check frontend linter rules to Typescript sources
cmds:
- docker-compose run --rm --no-deps frontend-cli npx eslint '{src/**/*.{ts,html},e2e/**/*.ts}'
deps:
- frontend-dependencies
frontend-html-linter-check:
desc: Check frontend linter rules to HTML sources
cmds:
- docker-compose run --rm --no-deps frontend-cli npx htmlhint 'src/**/*.html' -c .htmlhintrc
deps:
- frontend-dependencies
##############
# DEPLOYMENT #
##############
frontend-build-docker-image-dev:
desc: Build frontend Docker dev image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/frontend-webserver/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=dev --tag eu.gcr.io/aperturedevs/sob-frontend-webserver:dev --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/develop
frontend-publish-docker-image-dev:
desc: Publish frontend Docker dev image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-frontend-webserver:dev
frontend-build-docker-image-preprod:
desc: Build frontend Docker preprod image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/frontend-webserver/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=preprod --tag eu.gcr.io/aperturedevs/sob-frontend-webserver:preprod --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/develop
frontend-publish-docker-image-preprod:
desc: Publish frontend Docker preprod image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-frontend-webserver:preprod
frontend-build-docker-image-prod:
desc: Build frontend Docker prod image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/frontend-webserver/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=prod --tag eu.gcr.io/aperturedevs/sob-frontend-webserver:prod --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/main
frontend-publish-docker-image-prod:
desc: Publish frontend Docker prod image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-frontend-webserver:prod
api-build-docker-image-dev:
desc: Build API Docker dev image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/api-php/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=dev --tag eu.gcr.io/aperturedevs/sob-api-php:dev --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/develop
api-publish-docker-image-dev:
desc: Publish API Docker dev image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-api-php:dev
api-build-docker-image-preprod:
desc: Build API Docker preprod image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/api-php/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=prod --tag eu.gcr.io/aperturedevs/sob-api-php:preprod --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/develop
api-publish-docker-image-preprod:
desc: Publish API Docker preprod image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-api-php:preprod
api-build-docker-image-prod:
desc: Build API Docker prod image
cmds:
- docker buildx build --platform linux/amd64 --file docker/infra/api-php/Dockerfile --build-arg COMMIT_HASH={{ .COMMIT_HASH }} --build-arg APP_ENV=prod --tag eu.gcr.io/aperturedevs/sob-api-php:prod --output=type=docker .
vars:
COMMIT_HASH:
sh: git rev-parse origin/main
api-publish-docker-image-prod:
desc: Publish API Docker prod image
cmds:
- docker push eu.gcr.io/aperturedevs/sob-api-php:prod