|
| 1 | +DOCKER_COMPOSE ?= docker-compose |
| 2 | +EXEC_PHP = $(DOCKER_COMPOSE) run --rm -T php$(PHP_VERSION) |
| 3 | +PHP_VERSION ?= 7.3 |
| 4 | +DEPS ?= "LOCKED" |
| 5 | +COMPOSER = $(EXEC_PHP) composer |
| 6 | +WITH_COVERAGE ?= "FALSE" |
| 7 | + |
| 8 | +build: |
| 9 | + @$(DOCKER_COMPOSE) pull --parallel --ignore-pull-failures 2> /dev/null |
| 10 | + $(DOCKER_COMPOSE) build php$(PHP_VERSION) |
| 11 | + |
| 12 | +kill: |
| 13 | + $(DOCKER_COMPOSE) kill |
| 14 | + $(DOCKER_COMPOSE) down --volumes --remove-orphans |
| 15 | + |
| 16 | +setup: ## Setup spellcheckers dependencies |
| 17 | +setup: build |
| 18 | + $(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate languagetools |
| 19 | + |
| 20 | +.PHONY: build kill setup |
| 21 | + |
| 22 | +tests: ## Run all tests |
| 23 | +tests: |
| 24 | + if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml; else $(EXEC_PHP) vendor/bin/phpunit; fi |
| 25 | + |
| 26 | +tests-dox: ## Run all tests in dox format |
| 27 | +tests-dox: |
| 28 | + if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml --testdox; else $(EXEC_PHP) vendor/bin/phpunit --testdox; fi |
| 29 | + |
| 30 | +tu: ## Run unit tests |
| 31 | +tu: vendor |
| 32 | + $(EXEC_PHP) vendor/bin/phpunit --exclude-group integration |
| 33 | + |
| 34 | +ti: ## Run functional tests |
| 35 | +ti: vendor |
| 36 | + $(EXEC_PHP) vendor/bin/phpunit --group integration |
| 37 | + |
| 38 | +scrutinizer: |
| 39 | + $(EXEC_PHP) curl -L https://scrutinizer-ci.com/ocular.phar -o ocular.phar -s |
| 40 | + $(EXEC_PHP) php ocular.phar code-coverage:upload --format=php-clover clover.xml |
| 41 | + |
| 42 | +.PHONY: tests tests-dox tu ti |
| 43 | + |
| 44 | +vendor: |
| 45 | + if [ $(DEPS) = "LOWEST" ]; then $(COMPOSER) update --prefer-lowest; fi |
| 46 | + if [ $(DEPS) = "LOCKED" ]; then $(COMPOSER) install; fi |
| 47 | + if [ $(DEPS) = "HIGHEST" ]; then $(COMPOSER) update; else $(COMPOSER) install; fi |
| 48 | + |
| 49 | +rector: |
| 50 | + docker run -v $(pwd):/project rector/rector:latest bin/rector process /project/src/ --config vendor/thecodingmachine/safe/rector-migrate.yml --autoload-file /project/vendor/autoload.php |
| 51 | + |
| 52 | +phpcs: vendor |
| 53 | + $(EXEC_PHP) vendor/bin/phpcs |
| 54 | + |
| 55 | +phpcbf: vendor |
| 56 | + $(EXEC_PHP) vendor/bin/phpcbf |
| 57 | + |
| 58 | +phpstan: vendor |
| 59 | + $(EXEC_PHP) vendor/bin/phpstan analyse src -c phpstan.neon -a vendor/autoload.php |
| 60 | + |
| 61 | +.PHONY: vendor php-cs php-cbf php-stan |
| 62 | + |
| 63 | +.DEFAULT_GOAL := help |
| 64 | +help: |
| 65 | + @grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/' |
| 66 | +.PHONY: help |
0 commit comments