forked from phpDocumentor/guides
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (43 loc) · 1.92 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
PHP_BIN = docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli php -d memory_limit=1024M
.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: code-style
code-style:
$(PHP_BIN) vendor/bin/phpcs
.PHONY: fix-code-style
fix-code-style:
$(PHP_BIN) vendor/bin/phpcbf
.PHONY: static-code-analysis
static-code-analysis: vendor phpstan psalm test-architecture ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
.PHONY: phpstan
phpstan:
$(PHP_BIN) -d memory_limit=1024M vendor/bin/phpstan --configuration=phpstan.neon
.PHONY: psalm
psalm:
$(PHP_BIN) vendor/bin/psalm --update-baseline
.PHONY: test
test: test-unit test-functional test-integration## Runs all test suites with phpunit/phpunit
.PHONY: test-unit
test-unit: ## Runs unit tests with phpunit/phpunit
$(PHP_BIN) vendor/bin/phpunit --testsuite=unit
.PHONY: test-functional
test-functional: ## Runs functional tests with phpunit/phpunit
$(PHP_BIN) vendor/bin/phpunit --testsuite=functional
.PHONY: test-integration
test-integration: ## Runs integration tests with phpunit/phpunit
$(PHP_BIN) vendor/bin/phpunit --testsuite=integration
.PHONY: cleanup-tests
cleanup-tests: ## Cleans up temp directories created by test-integration
$(PHP_BIN) find ./tests -type d -name 'temp' -exec rm -rf {} \;
.PHONY: test-architecture
test-architecture: vendor ## Runs deptrac to enfore architecural rules
$(PHP_BIN) ./vendor/bin/deptrac --config-file deptrac.packages.yaml
vendor: composer.json composer.lock
composer validate --no-check-publish
composer install --no-interaction --no-progress --ignore-platform-reqs
.PHONY: rector
rector: ## Refactor code using rector
$(PHP_BIN) vendor/bin/rector process packages
.PHONY: pre-commit-test
pre-commit-test: fix-code-style test code-style static-code-analysis