Skip to content

Instantly share code, notes, and snippets.

@bendavies
Created November 8, 2022 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bendavies/62859acb95ac9158b237ff3c16bef5e5 to your computer and use it in GitHub Desktop.
Save bendavies/62859acb95ac9158b237ff3c16bef5e5 to your computer and use it in GitHub Desktop.
.DEFAULT_GOAL := help
.EXPORT_ALL_VARIABLES:
APP_ENV = test
APP_DEBUG = false
.PHONY: it
it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis and tests targets
.PHONY: coding-standards
coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize and fixes code style issues with friendsofphp/php-cs-fixer
composer normalize
vendor/bin/php-cs-fixer fix --diff --verbose
.PHONY: help
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: schema
schema: ## Validate the application schema
bin/console doctrine:query:sql "alter database abacus_test WITH is_template false" || true
bin/console doctrine:database:drop --ansi --if-exists --force;
bin/console doctrine:database:create --ansi;
bin/console doctrine:migrations:migrate --ansi --no-interaction;
bin/console doctrine:schema:validate --ansi;
.PHONY: static-code-analysis
static-code-analysis: vendor var/cache/test/App_KernelTestDebugContainer.xml ## Runs a static code analysis with phpstan/phpstan
vendor/bin/phpstan analyse
.PHONY: tests
tests: vendor ## Runs tests with phpspec/phpspec and phpunit/phpunit
vendor/bin/phpspec run
vendor/bin/phpunit
var/cache/test/App_KernelTestDebugContainer.xml: vendor
DATABASE_URL="?serverVersion=12.4" APP_DEBUG=true ./bin/console cache:warmup
vendor: composer.json composer.lock
composer validate
composer install --no-interaction --no-progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment