|
| 1 | +version: '3' |
| 2 | + |
| 3 | +vars: |
| 4 | + # You can modify the coverage threshold here |
| 5 | + COVERAGE_THRESHOLD: 100 |
| 6 | + |
| 7 | +tasks: |
| 8 | + ## —— Symfony binary 💻 ———————————————————————————————————————————————————————— |
| 9 | + start: |
| 10 | + desc: Serve the application with the Symfony binary |
| 11 | + cmd: symfony serve --daemon |
| 12 | + |
| 13 | + stop: |
| 14 | + desc: Stop the web server |
| 15 | + cmd: symfony server:stop |
| 16 | + |
| 17 | + ## —— Symfony 🎶 —————————————————————————————————————————————————————————————— |
| 18 | + go-prod: |
| 19 | + desc: Switch to the production environment |
| 20 | + cmds: |
| 21 | + - cp .env.local.dist .env.local |
| 22 | + # uncomment this line to optimize the auto-loading of classes in the prod env |
| 23 | + # - composer dump-autoload --no-dev --classmap-authoritative |
| 24 | + - bin/console asset-map:compile |
| 25 | + |
| 26 | + go-dev: |
| 27 | + desc: Switch to the development environment |
| 28 | + cmds: |
| 29 | + - rm -f .env.local |
| 30 | + - rm -rf ./public/assets/* |
| 31 | + |
| 32 | + warmup: |
| 33 | + desc: Warmup the dev cache for the static analysis |
| 34 | + cmd: bin/console c:w --env=dev |
| 35 | + |
| 36 | + purge: |
| 37 | + desc: Purge all Symfony cache and logs |
| 38 | + cmd: rm -rf ./var/cache/* ./var/logs/* ./var/coverage/* |
| 39 | + |
| 40 | + ## —— Tests ✅ ————————————————————————————————————————————————————————————————— |
| 41 | + test: |
| 42 | + desc: Run all PHPUnit tests |
| 43 | + cmd: vendor/bin/phpunit |
| 44 | + |
| 45 | + coverage: |
| 46 | + desc: Generate the HTML PHPUnit code coverage report (stored in var/coverage) |
| 47 | + cmds: |
| 48 | + - task: purge |
| 49 | + - XDEBUG_MODE=coverage php -d xdebug.enable=1 -d memory_limit=-1 vendor/bin/phpunit --coverage-html=var/coverage --coverage-clover=var/coverage/clover.xml |
| 50 | + - php bin/coverage-checker.php var/coverage/clover.xml {{.COVERAGE_THRESHOLD}} |
| 51 | + |
| 52 | + cov-report: |
| 53 | + desc: Open the PHPUnit code coverage report (var/coverage/index.html) |
| 54 | + cmd: open var/coverage/index.html |
| 55 | + preconditions: |
| 56 | + - test -f var/coverage/index.html |
| 57 | + |
| 58 | + ## —— Coding standards/lints ✨ ———————————————————————————————————————————————— |
| 59 | + stan: |
| 60 | + desc: Run PHPStan |
| 61 | + cmds: |
| 62 | + - APP_DEBUG=1 APP_ENV=dev bin/console cache:warmup |
| 63 | + - vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1G -vv |
| 64 | + |
| 65 | + fix-php: |
| 66 | + desc: Fix PHP files with php-cs-fixer (ignore PHP 8.2 warning) |
| 67 | + cmd: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix |
| 68 | + |
| 69 | + lint-php: |
| 70 | + desc: Lint PHP files with php-cs-fixer (report only) |
| 71 | + cmd: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --dry-run |
| 72 | + |
| 73 | + lint-container: |
| 74 | + desc: Lint the Symfony DI container |
| 75 | + cmd: bin/console lint:container |
| 76 | + |
| 77 | + lint-twig: |
| 78 | + desc: Lint Twig files |
| 79 | + cmd: bin/console lint:twig templates/ |
| 80 | + |
| 81 | + lint-yaml: |
| 82 | + desc: Lint YAML files |
| 83 | + cmd: bin/console lint:yaml --parse-tags config/ |
| 84 | + |
| 85 | + cs: |
| 86 | + desc: Run all CS checks |
| 87 | + cmds: |
| 88 | + - task: fix-php |
| 89 | + - task: stan |
| 90 | + |
| 91 | + lint: |
| 92 | + desc: Run all lints |
| 93 | + cmds: |
| 94 | + - task: lint-php |
| 95 | + - task: lint-container |
| 96 | + - task: lint-twig |
| 97 | + - task: lint-yaml |
| 98 | + |
| 99 | + ci: |
| 100 | + desc: Run CI locally |
| 101 | + cmds: |
| 102 | + - task: coverage |
| 103 | + - task: warmup |
| 104 | + - task: cs |
| 105 | + - task: lint |
| 106 | + |
| 107 | + ## —— Other tools and helpers 🔨 ——————————————————————————————————————————————— |
| 108 | + versions: |
| 109 | + desc: Display current stack versions |
| 110 | + cmds: |
| 111 | + - task: version-php |
| 112 | + - task: version-composer |
| 113 | + - task: version-symfony |
| 114 | + - task: version-phpunit |
| 115 | + - task: version-phpstan |
| 116 | + - task: version-php-cs-fixer |
| 117 | + version-php: |
| 118 | + desc: Display PHP version |
| 119 | + cmd: php -v |
| 120 | + version-composer: |
| 121 | + desc: Display Composer version |
| 122 | + cmd: composer --version |
| 123 | + version-symfony: |
| 124 | + desc: Display Symfony version |
| 125 | + cmd: bin/console --version |
| 126 | + version-phpunit: |
| 127 | + desc: Display PHPUnit version |
| 128 | + cmd: vendor/bin/phpunit --version |
| 129 | + version-phpstan: |
| 130 | + desc: Display PHPStan version |
| 131 | + cmd: vendor/bin/phpstan --version |
| 132 | + version-php-cs-fixer: |
| 133 | + desc: Display PHP CS Fixer version |
| 134 | + cmd: vendor/bin/php-cs-fixer --version |
| 135 | + |
| 136 | + check-requirements: |
| 137 | + desc: Checks requirements for running Symfony |
| 138 | + cmd: vendor/bin/requirements-checker |
0 commit comments