-
Notifications
You must be signed in to change notification settings - Fork 162
/
Makefile
100 lines (78 loc) · 2.27 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
-include Makefile.local
export XDEBUG_MODE=coverage
export PHP_CS_FIXER_IGNORE_ENV=1
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
PATH := $(CURDIR)/vendor/bin:$(PATH)
PSALM_FLAGS ?=
PHPUNIT_FLAGS ?=
INFECTION_FLAGS ?=
.PHONY: help
help:
@echo 'Available targets'
@echo ' clean Removes temporary build artifacts like'
@echo ' website Builds the documentation website'
@echo ' fix Fixes composer.json and code style'
@echo ' fix-prettier Fix code style of non PHP files (not included in "fix" target)'
@echo ' test Execute all tests'
@echo ' vendor Installs composer vendor'
.PHONY: test
test: test-validate-composer test-code-style test-psalm test-phpunit test-examples test-composer-normalize test-phpmd test-infection
.PHONY: test-code-style
test-code-style: vendor
php-cs-fixer fix --dry-run --diff
.PHONY: test-psalm
test-psalm: vendor
psalm -m --no-progress ${PSALM_FLAGS}
.PHONY: test-phpunit
test-phpunit: vendor
phpunit ${PHPUNIT_FLAGS}
.PHONY: test-examples
EXAMPLE_FILES := $(wildcard examples/*.php)
test-examples: $(EXAMPLE_FILES)
.PHONY: test-infection
test-infection: vendor test-phpunit
test-infection:
infection --min-msi=60 --coverage=build/coverage ${INFECTION_FLAGS}
examples/example*.php: vendor
php $@ > /dev/null
.PHONY: test-validate-composer
test-validate-composer:
composer validate
.PHONY: test-composer-normalize
test-composer-normalize: vendor
test-composer-normalize:
composer normalize --dry-run --diff
.PHONY: test-phpmd
test-phpmd: vendor
test-phpmd:
phpmd ./src text rulesets.xml
.PHONY: test-prettier
test-prettier:
yarn
npx prettier --check .
vendor: composer.json composer.lock
composer install --no-interaction
.PHONY: fix
fix: fix-code-style fix-composer
.PHONY: fix-code-style
fix-code-style: vendor
fix-code-style:
php-cs-fixer -- fix
.PHONY: fix-composer
fix-composer: vendor
fix-composer:
composer normalize --no-update-lock
composer update nothing
.PHONY: fix-prettier
fix-prettier: node_modules
npx prettier --write .
node_modules: yarn.lock package.json
yarn
.PHONY: website
website:
cd website && $(MAKE) build
.PHONY: clean
clean:
rm -rf vendor node_modules .phpunit.result.cache .php-cs-fixer.cache build
cd website && $(MAKE) clean