-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
84 lines (63 loc) · 2.68 KB
/
Makefile
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
DOCKER_COMPOSE ?= docker-compose
EXEC_PHP = $(DOCKER_COMPOSE) run --rm -T php
PHP_VERSION ?= 8.2
DEPS_STRATEGY ?= --prefer-stable
COMPOSER = $(EXEC_PHP) composer
WITH_COVERAGE ?= "FALSE"
EXAMPLES_DIR ?= "examples"
pull:
@$(DOCKER_COMPOSE) pull languagetools jamspell php
build:
$(DOCKER_COMPOSE) build --no-cache php
push:
$(DOCKER_COMPOSE) push php
kill:
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) down --volumes --remove-orphans
setup: ## Setup spellcheckers dependencies
setup: build
$(DOCKER_COMPOSE) up -d --remove-orphans --no-recreate languagetools jamspell
.PHONY: build kill setup
tests: ## Run all tests
tests:
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml; else $(EXEC_PHP) vendor/bin/phpunit; fi
tests-dox: ## Run all tests in dox format
tests-dox:
if [ $(WITH_COVERAGE) = true ]; then $(EXEC_PHP) vendor/bin/phpunit --coverage-clover clover.xml --testdox; else $(EXEC_PHP) vendor/bin/phpunit --testdox; fi
# @TODO not optimized, it recreates a container for each example
examples-test:
for file in `ls examples/*.php`; \
do \
echo "\n**************************************************************"; \
echo "Run example: $$file"; \
echo "**************************************************************\n"; \
sh -c "$(EXEC_PHP) php $$file" || exit 1 ;\
done
tu: ## Run unit tests
tu: vendor
$(EXEC_PHP) vendor/bin/phpunit --exclude-group integration
ti: ## Run functional tests
ti: vendor
$(EXEC_PHP) vendor/bin/phpunit --group integration
.PHONY: tests tests-dox examples-test tu ti
vendor:
$(COMPOSER) update $(DEPS_STRATEGY)
PHP_CS_FIXER = docker-compose run --rm -T php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -vv --allow-risky=yes
phpcs:
PHP_VERSION=8.1 $(EXEC_PHP) composer -d tools/php-cs-fixer update
PHP_VERSION=8.1 $(PHP_CS_FIXER) --dry-run
phpcbf:
PHP_VERSION=8.1 $(EXEC_PHP) composer -d tools/php-cs-fixer update
PHP_VERSION=8.1 $(PHP_CS_FIXER)
phpstan: vendor
$(EXEC_PHP) vendor/bin/phpstan analyse src -c phpstan.neon -a vendor/autoload.php
phpstan-baseline: vendor
$(EXEC_PHP) vendor/bin/phpstan analyse src -c phpstan.neon -a vendor/autoload.php --generate-baseline
infection: vendor
$(EXEC_PHP) vendor/bin/phpunit --coverage-xml=build/coverage/coverage-xml --log-junit=build/coverage/phpunit.junit.xml
$(EXEC_PHP) php infection.phar --threads=4 --coverage=build/coverage --min-covered-msi=74
.PHONY: vendor php-cs phpcbf phpstan
.DEFAULT_GOAL := help
help:
@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/'
.PHONY: help