-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
843 lines (755 loc) · 22.3 KB
/
Taskfile.yml
File metadata and controls
843 lines (755 loc) · 22.3 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
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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
version: 3
# Main Taskfile - Global tasks and inclusions
# Automatically loads variables from .env file if it exists
dotenv: [ '.env' ]
includes:
docker: ./taskfiles/docker/Taskfile.yml
utils: ./taskfiles/utils/Taskfile.yml
env: ./taskfiles/env/Taskfile.yml
nodejs: ./taskfiles/nodejs/Taskfile.yml
download: ./taskfiles/download/Taskfile.yml
apache: ./taskfiles/apache/Taskfile.yml
lint: ./taskfiles/lint/Taskfile.yml
vars:
# Variables with default values from .env or fallback values
PROJECT_NAME: '{{.PROJECT_NAME | default "labstag"}}'
ENVIRONMENT: '{{.ENVIRONMENT | default "development"}}'
STACK_NAME: '{{.STACK | default "labstag"}}'
FOLDERSQL: '{{.FOLDERSQL | default "database_init"}}'
FILESQL: '{{.FILESQL | default "dump.sql"}}'
FOLDERLAMPY: '{{.FOLDERLAMPY | default "lampy"}}'
SERVERNAME: '{{.SERVERNAME | default "labstag.traefik.me"}}'
DOCKERCOMPOSEFILE: '{{.DOCKERCOMPOSEFILE | default "docker-compose.yml"}}'
tasks:
default:
desc: "Display help and available tasks"
silent: true
cmds:
- echo "🛠️ Collection of Taskfiles for development"
- echo ""
- echo "Available global tasks:"
- task --list
- echo ""
info:
desc: "Display project information with environment variables"
silent: true
cmds:
- |
export PROJECT_VERSION=$(jq -r .version package.json)
echo "🛠️ {{.PROJECT_NAME}} v$PROJECT_VERSION - Collection of Taskfiles"
echo "Environment: {{.ENVIRONMENT}}"
help:
desc: "Display detailed help"
aliases: [ h ]
cmds:
- task: default
labstag:fix-permissions:
desc: "Fix Labstag file permissions (manual use if necessary)"
silent: true
cmds:
- chmod -R 755 ./apps
- chmod -R 777 ./apps/var
- chmod -R 777 ./apps/public/uploads
labstag:getapacheconf:
desc: "Retrieve Apache configuration from Docker image"
silent: true
cmds:
- rm -rf ./conf/apache2 || true
- mkdir -p ./conf/apache2
- task docker:create CONTAINER_NAME=labstagphp IMAGE_NAME=$(awk '/www:/ {f=1} f && /image:/ {print $2; exit}' {{.DOCKERCOMPOSEFILE}})
- task: docker:getfile
vars:
CONTAINER_NAME: "labstagphp"
FILE_PATH: "/etc/apache2/sites-available/000-default.conf"
DEST_PATH: "./conf/apache2/000-default.conf"
- task: docker:getfile
vars:
CONTAINER_NAME: "labstagphp"
FILE_PATH: "/etc/apache2/apache2.conf"
DEST_PATH: "./conf/apache2/apache2.conf"
- docker rm -f labstagphp
- task: apache:updateconfig
vars:
SERVERNAME: "{{.SERVERNAME}}"
APACHE_DOCUMENT_ROOT: "/var/www/public"
labstag:copysql:
desc: "Copy SQL dump file to labstag folder"
silent: true
cmds:
- task: utils:file:copy
vars:
SOURCE_FILE: ./{{.FOLDERSQL}}/{{.FILESQL}}
DEST_DIR: "{{.FOLDERLAMPY}}/mariadb_init/"
FORCE: true
labstag:getpull-image:
desc: "Download Docker images defined in docker-compose.yml"
silent: true
cmds:
- task: docker:images:pull
vars:
COMPOSE_FILE: "{{.DOCKERCOMPOSEFILE}}"
labstag:deploy:
desc: "Deploy Docker stacks defined in docker-compose files"
silent: true
cmds:
- task: docker:stack:deploy
vars:
COMPOSE_FILE: "{{.DOCKERCOMPOSEFILE}}"
STACK_NAME: "{{.STACK_NAME}}"
labstag:install-first:
desc: "Initial installation of Composer and dependencies"
silent: false
cmds:
- docker run --rm -v $(pwd)/apps:/var/www -w /var/www $(awk '/www:/ {f=1} f && /image:/ {print $2; exit}' {{.DOCKERCOMPOSEFILE}}) symfony composer install
labstag:waiting:
desc: "Wait for services to be operational"
silent: true
cmds:
- task: docker:stack:check:containers:ready
vars:
CONTAINERS: "www"
STACK_NAME: "{{.STACK_NAME}}"
labstag:ls:
desc: "List Docker stacks and services"
silent: true
cmds:
- task: docker:stack:services
vars:
STACK_NAME: "{{.STACK_NAME}}"
labstag:exec:
desc: "Execute a command in a running container"
cmds:
- task: labstag:set-env-ids
- task: labstag:copysql
- task: labstag:getpull-image
- task: labstag:getapacheconf
- task: labstag:deploy
- task: labstag:waiting
- task: labstag:ls
labstag:download-phar:
desc: "Download various phar files"
cmds:
- task: download:php:tools
vars:
TOOLS_DIR: ./../apps
labstag:bash:
desc: "Open a bash shell in the www container"
preconditions:
- sh: docker service ls | grep -q {{.STACK_NAME}}_www
msg: "Docker service {{.STACK_NAME}}_www is not started. Run 'task labstag:deploy' first"
cmds:
- task: docker:stack:shell
vars:
STACK_NAME: "labstag"
SERVICE_NAME: "www"
labstag:cmd-exec:
desc: "Execute a command in the Docker container"
silent: true
vars:
INTERACTIVE: '{{.INTERACTIVE | default "true"}}'
preconditions:
- sh: docker service ls | grep -q {{.STACK_NAME}}_www
msg: "Docker service {{.STACK_NAME}}_www is not started. Run 'task labstag:deploy' first"
cmds:
- task: docker:stack:exec
vars:
STACK_NAME: "labstag"
SERVICE_NAME: "www"
COMMAND: "{{.COMMAND}}"
INTERACTIVE: "{{.INTERACTIVE}}"
symfony:about:
desc: "Show Symfony information"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "about"
symfony:console:
desc: "Execute a Symfony command"
internal: true
silent: true
preconditions:
- sh: docker service ls | grep -q {{.STACK_NAME}}_www
msg: "Docker service {{.STACK_NAME}}_www is not started. Run 'task labstag:deploy' first"
vars:
CMD: '{{.CMD | default ""}}'
# Disable interactivity in CI/CD environment
INTERACTIVE: '{{if or (eq (env "DOCKER_INTERACTIVE") "false") (eq (env "CI") "true") (eq (env "GITHUB_ACTIONS") "true")}}false{{else}}true{{end}}'
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "symfony console {{.CMD}}"
labstag:assets:
desc: "Install Symfony assets"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "assets:install public --symlink --relative"
labstag:cache-clear:
desc: "Clear Symfony cache"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "cache:clear"
composer:exec:
desc: "Execute a Composer command"
silent: true
vars:
CMD: '{{.CMD | default ""}}'
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "symfony composer {{.CMD}}"
composer:fund:
desc: "Show funding links of Composer dependencies"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "fund"
composer:install:
desc: "Install Composer dependencies"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "install"
composer:outdated:
desc: "Show outdated dependencies"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "outdated"
composer:suggests:
desc: "Show Composer dependency suggestions"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "suggests"
composer:update:
desc: "Update Composer dependencies"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "update"
doctrine:fixtures:
desc: "Load Doctrine fixtures"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "doctrine:fixtures:load --no-interaction"
doctrine:migrate:
desc: "Execute Doctrine migrations"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "doctrine:migrations:migrate -n"
doctrine:schema:update:
desc: "Update database schema"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "doctrine:schema:update --dump-sql --force"
doctrine:schema:validate:
desc: "Validate database schema"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "doctrine:schema:validate"
composer:validate:
desc: "Validate composer.json file"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "validate"
composer:install:dev:
desc: "Install Composer dependencies for development"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "install --no-progress --prefer-dist --optimize-autoloader"
composer:install:prod:
desc: "Install Composer dependencies for production"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "install --no-progress --prefer-dist --optimize-autoloader --no-dev"
ecs-check:
desc: "Check code with PHP CS Fixer"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run ecs-check"
ecs-fix:
desc: "Fix code with PHP CS Fixer"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run ecs-fix"
labstag:delete-oldfiles:
desc: "Delete old temporary files"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "labstag:delete-oldfiles"
labstag:geocode-install:
desc: "Install geocoding data"
silent: true
vars:
COUNTRY: '{{.COUNTRY | default ""}}'
cmds:
- task: symfony:console
vars:
CMD: "labstag:geocode-install {{.COUNTRY}}"
lint:container:
desc: "Check service configuration file syntax"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "lint:container"
lint:php-cs-fixer:
desc: "Check code with PHP CS Fixer"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/php-cs-fixer fix src"
lint:php-cs-fixer:dry:
desc: "Check code with PHP CS Fixer in dry-run mode"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/php-cs-fixer fix src --dry-run -v --diff"
lint:phpcbf:
desc: "Fix code with PHP Code Beautifier and Fixer"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/phpcbf -d memory_limit=-1 --report=diff -p --extensions=php --standard=phpcs.xml"
lint:phpcs:
desc: "Check code with PHP CodeSniffer"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/phpcs --report=full --extensions=php src --standard=phpcs.xml"
lint:phpcs:error:
desc: "Check code with PHP CodeSniffer and show only errors"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/phpcs --report=full --extensions=php --warning-severity=0 --standard=phpcs.xml"
lint:phpcs:warning:
desc: "Check code with PHP CodeSniffer and show only warnings"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 bin/phpcs --report=full --extensions=php --error-severity=0 --standard=phpcs.xml"
lint:phpdoc:
desc: "Check PHPDoc annotations with phpDocumentor"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 phpDocumentor.phar -d src -t public/docs"
lint:phploc:
desc: "Analyze code complexity with phploc"
silent: true
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "php -d memory_limit=-1 phploc.phar src"
phpstan:
desc: "Analyze code with PHPStan"
silent: true
vars:
LEVEL: '{{.LEVEL | default "0"}}'
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "bin/phpstan analyse -l {{.LEVEL}}"
lint:twig:
desc: "Check Twig templates"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "lint:twig templates"
messenger:consume:
desc: "Start Messenger message consumer"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "messenger:consume --all"
messenger:stats:
desc: "Show Messenger statistics"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "messenger:stats"
rector:
desc: "Refactor code with Rector"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run rector"
rector:dry:
desc: "Refactor code with Rector in dry-run mode"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run rector-dry"
star:get:
desc: "Download star data"
silent: true
cmds:
- gh api --paginate /user/starred --jq '.' | jq -s > apps/private/stars.json
star:add:
desc: "Add star data"
silent: true
cmds:
- task: symfony:console
vars:
CMD: "labstag:star-add"
star:
desc: "Download and update star data"
silent: true
cmds:
- task: star:get
- task: star:add
test:phpunit:
desc: "Run PHPUnit tests"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run simple-phpunit"
test:phpunit:unit-integration:
desc: "Run PHPUnit unit and integration tests"
silent: true
cmds:
- task: composer:exec
vars:
CMD: "run simple-phpunit-unit-integration"
translation:
desc: "Manage translations with Symfony"
silent: true
vars:
LOCALE: '{{.LOCALE | default "fr"}}'
cmds:
- task: symfony:console
vars:
CMD: "translation:extract --force {{.LOCALE}}"
workflow:dump:
desc: "Generate entity workflow in PNG format via temporary DOT file"
internal: true
silent: true
vars:
ENTITY: '{{.ENTITY | default "chapter"}}'
FILE: '{{.ENTITY}}.png'
DOT_FILE: '{{.ENTITY}}.dot'
cmds:
- task: labstag:cmd-exec
vars:
COMMAND: "sh -c 'symfony console workflow:dump {{.ENTITY}} > {{.DOT_FILE}}'"
- task: labstag:cmd-exec
vars:
COMMAND: "sh -c 'dot -Tpng {{.DOT_FILE}} -o {{.FILE}}'"
- task: labstag:cmd-exec
vars:
COMMAND: "rm {{.DOT_FILE}} && echo 'Temporary DOT file deleted'"
workflow:dump:all:
desc: "Show workflows for all entities"
silent: true
vars:
ENTITIES: "chapter,edito,story,memo,post,page,user"
cmds:
- echo "🚀 Generating all workflows..."
- echo ""
- for: { var: ENTITIES, split: ',' }
task: workflow:dump
vars:
ENTITY: "{{.ITEM}}"
- echo ""
- echo "🎉 Generation completed!"
ignore_error: true
lint:all:
desc: "Run all available linters"
silent: true
vars:
SKIP_DOCKER: '{{.SKIP_DOCKER | default "false"}}'
cmds:
- task: lint:yml
vars:
IGNORE_DIR: "lampy,taskfiles,apps/vendor"
- task: lint:md
vars:
IGNORE_DIR: "lampy,taskfiles"
- task: lint:action
- |
if [ "{{.SKIP_DOCKER}}" = "true" ]; then
echo "⏭ Skip lint:docker"
else
task lint:docker DOCKERCOMPOSEFILE="{{.DOCKERCOMPOSEFILE}}"
fi
- task: cmd:validate_outdated
- npm run eslint
- npm run lint:stylelint
- task: lint:twig
- task: lint:container
- task: lint:phpaudit
quality:all:
desc: "Run all quality checks: linters + tests + static analysis"
cmds:
- echo "🔍 Complete quality checks in progress..."
- task: lint:all
- task: test:all
- task: phpstan:5
- echo "✅ Quality checks completed!"
quality:ci:
desc: "Quality checks for continuous integration"
cmds:
- echo "🔄 CI quality checks in progress..."
- task: lint:phpaudit
- task: test:quick
- task: phpstan:8
- echo "✅ CI quality checks completed!"
fix:all:
desc: "Automatically fix code issues"
silent: true
cmds:
- npm run eslint:fix
- npm run lint:stylelint:fix
- task: ecs-fix
- task: lint:phpcbf
- task: lint:phpcs
- task: rector
ignore_error: true
lint:phpaudit:
desc: "Analyze code with PHP Audit"
silent: true
cmds:
- task: lint:phpcs:error
- task: phpstan
vars:
LEVEL: "0"
cmd:validate_outdated:
desc: "Validate outdated dependencies"
silent: true
cmds:
- task: composer:validate
- task: composer:outdated
cmd:install:all:
desc: "Install all dependencies and run migrations"
silent: true
cmds:
- task: doctrine:migrate
- task: labstag:assets
- npm run encore:dev
cmd:install:bdd:
desc: "Install database with fixtures"
silent: true
cmds:
- task: doctrine:fixtures
cmd:install:dev:
desc: "Install complete development environment"
silent: true
cmds:
- task: download:phar
- task: cmd:install:all
- task: cmd:install:bdd
cmd:install:prod:
desc: "Install complete production environment"
silent: true
cmds:
- task: cmd:install:all
- task: cmd:install:bdd
- npm run encore:build
data:
desc: "Install demonstration data"
silent: true
cmds:
- task: doctrine:fixtures
- task: labstag:delete-oldfiles
- task: star:add
labstag:set-env-ids:
desc: "Update UID/GID in .env file"
silent: true
cmds:
- |
if ! grep -q "UID=" .env; then
echo "UID=$(id -u)" >> .env
else
sed -i "s/UID=.*/UID=$(id -u)/" .env
fi
- |
if ! grep -q "GID=" .env; then
echo "GID=$(id -g)" >> .env
else
sed -i "s/GID=.*/GID=$(id -g)/" .env
fi
# =====================================
# TÂCHES DE TESTS (DOCKER ONLY)
# =====================================
test:setup:
desc: "Prepare test environment in container"
silent: true
cmds:
- echo "🔧 Preparing test environment..."
- echo "ℹ️ Using SQLite file database for tests"
- task: labstag:cmd-exec
vars:
COMMAND: "rm -f var/test.db"
INTERACTIVE: "false"
- task: symfony:console
vars:
CMD: "doctrine:schema:update --env=test --force"
- task: symfony:console
vars:
CMD: "doctrine:fixtures:load --env=test --no-interaction"
- echo "✅ Test environment ready"
test:unit:
desc: "Run unit tests"
silent: true
cmds:
- echo "🧪 Running unit tests..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --testsuite=unit --colors=always"
INTERACTIVE: "false"
- echo "✅ Unit tests completed"
test:integration:
desc: "Run integration tests"
silent: true
cmds:
- echo "🔗 Running integration tests..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --testsuite=integration --colors=always"
INTERACTIVE: "false"
- echo "✅ Integration tests completed"
test:functional:
desc: "Run functional tests"
silent: true
cmds:
- echo "🌐 Running functional tests..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --testsuite=functional --colors=always"
INTERACTIVE: "false"
- echo "✅ Functional tests completed"
test:performance:
desc: "Run performance tests"
silent: true
cmds:
- echo "⚡ Running performance tests..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --testsuite=performance --colors=always"
INTERACTIVE: "false"
- echo "✅ Performance tests completed"
test:coverage:
desc: "Generate code coverage report"
silent: true
cmds:
- echo "📊 Generating coverage report..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --coverage-html var/coverage --colors=always"
INTERACTIVE: "false"
- echo "✅ Coverage report generated in var/coverage/"
test:all:
desc: "Run all tests (unit, integration, functional, performance)"
silent: true
cmds:
- echo "🚀 Running all tests..."
- task: test:setup
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --colors=always"
INTERACTIVE: "false"
- task: test:cleanup
- echo "✅ All tests completed successfully"
test:cleanup:
desc: "Clean up test environment"
silent: true
cmds:
- echo "🧹 Cleaning up test environment..."
- task: labstag:cmd-exec
vars:
COMMAND: "rm -f var/test.db"
INTERACTIVE: "false"
- echo "✅ Test environment cleaned"
test:quick:
desc: "Run only unit tests (fast)"
silent: true
cmds:
- echo "⚡ Quick tests (unit only)..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --testsuite=unit --colors=always --stop-on-failure"
INTERACTIVE: "false"
- echo "✅ Quick tests completed"
test:watch:
desc: "Run tests in watch mode (file monitoring)"
silent: true
preconditions:
- sh: command -v inotifywait
msg: "inotify-tools is not installed. Install it with 'sudo apt install inotify-tools'"
cmds:
- echo "👀 Test watch mode activated (Ctrl+C to stop)..."
- |
while true; do
inotifywait -r -e modify apps/src/ apps/tests/ --exclude=".*\.git.*|.*\.cache.*|.*var.*" -q
echo "🔄 File modified, rerunning tests..."
task labstag:cmd-exec COMMAND="php bin/phpunit --testsuite=unit --colors=always --stop-on-failure" INTERACTIVE=false
done
test:debug:
desc: "Run tests with detailed debugging information"
silent: true
cmds:
- echo "🐛 Running tests in debug mode..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --debug --colors=always"
INTERACTIVE: "false"
test:validate:
desc: "Validate test configuration"
silent: true
cmds:
- echo "✅ Validating test configuration..."
- task: labstag:cmd-exec
vars:
COMMAND: "php bin/phpunit --list-tests"
INTERACTIVE: "false"
- task: symfony:console
vars:
CMD: "lint:container --env=test"
- task: symfony:console
vars:
CMD: "doctrine:schema:validate --env=test"
- echo "✅ Test configuration is valid"