-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (38 loc) · 1.67 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
WORKSPACE ?= $(PWD)
REPORTS_DIR ?= build/reports
audit: phpcs phpmd phpstan ## Run static code analysis
.PHONY: audit
lint: phpcbf ## Run linting (alias to phpcbf)
phpcbf: ## Run PHP Code Beautifier and Fixer
vendor/bin/phpcbf --standard=phpcs.xml --extensions=php --ignore=vendor $(EXTRA_ARGS) .
.PHONY: lint phpcbf
phpcs: ## Run PHP_CodeSniffer
vendor/bin/phpcs --standard=phpcs.xml --extensions=php --ignore=vendor $(EXTRA_ARGS) .
phpcs-ci: prepare-ci ## Run PHP_CodeSniffer (CI)
EXTRA_ARGS="--report=junit --report-file=$(REPORTS_DIR)/phpcs.junit.xml" $(MAKE) phpcs
.PHONY: phpcs phpcs-ci
PHPMD_FORMAT ?= text
phpmd: ## Run PHP Mess Detector
vendor/bin/phpmd . $(PHPMD_FORMAT) phpmd.xml --suffixes php $(EXTRA_ARGS)
phpmd-ci: prepare-ci ## Run PHP Mess Detector (CI)
PHPMD_FORMAT="github" $(MAKE) phpmd
.PHONY: phpmd phpmd-ci
PHPSTAN_LEVEL ?= max
phpstan: ## Run PHPStan
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1 --level=$(PHPSTAN_LEVEL) $(EXTRA_ARGS) .
phpstan-ci: prepare-ci ## Run PHPStan (CI)
EXTRA_ARGS="--error-format=github --no-progress" $(MAKE) phpstan
.PHONY: phpstan phpstan-ci
unit-tests: phpunit ## Run unit tests (alias to phpunit)
phpunit: ## Run PHPUnit
vendor/bin/phpunit --exclude-group=functional $(EXTRA_ARGS)
phpunit-ci: prepare-ci ## Run unit tests (CI)
EXTRA_ARGS="--log-junit $(REPORTS_DIR)/unit-tests.junit.xml" $(MAKE) unit-tests
.PHONY: unit-tests unit-tests-ci
prepare-ci:
@mkdir -p build/reports
.PHONY: prepare-ci
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-25s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help
.DEFAULT_GOAL := help