-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
125 lines (77 loc) · 2.38 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
COMPOSER ?= composer
PHPUNIT_OPTS =
SYMFONY = symfony
PHP = php
help: Makefile
@echo
@echo " Choose a command run in Walnut:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
composer:
$(COMPOSER) install
cc:
rm -rf var/cache/*
clear: cc
rm -rf var/logs/*
fix-diff:
./vendor/bin/php-cs-fixer fix --diff --dry-run -v
clear_db:
rm -f ./var/cache/data.db
migrate:
@echo "\n==> Migrate DB Tables"
$(PHP) bin/console doctrine:schema:update --force
test: cc composer clear_db migrate
bin/phpunit -c . $(PHPUNIT_OPTS) --log-junit build/phpunit.xml --coverage-text
lint: cc lint-yaml lint-php phpcs php-cs lint-composer lint-eol
@echo All good.
lint-eol:
@echo "\n==> Validating unix style line endings of files:files"
@! grep -lIUr --color '^M' config/ public/ src/ composer.json composer.lock || ( echo '[ERROR] Above files have CRLF line endings' && exit 1 )
@echo All files have valid line endings
lint-composer:
@echo "\n==> Validating composer.json and composer.lock:"
$(COMPOSER) validate --strict
lint-yaml:
@echo "\n==> Validating all yaml files:"
./bin/console lint:yaml config
@find config -type f -name \*.yaml | while read file; do echo -n "$$file"; php bin/console --no-debug --no-interaction --env=test lint:yaml "$$file" || exit 1; done
lint-php:
@echo "\n==> Validating all php files:"
@find src tests -type f -name \*.php | while read file; do php -l "$$file" || exit 1; done
phpcs:
./vendor/bin/phpcs
php-cs:
./vendor/bin/php-cs-fixer fix --diff --dry-run -v
analyse:
@echo "\n==> Run phpstan analyse:"
vendor/bin/phpstan analyse src --memory-limit=-1
## coverage: Get Coverage Report
coverage: cc composer
@echo "\n==> Get Coverage Report:"
mkdir -p build/coverage
bin/phpunit --log-junit build/phpunit.xml
## fix: Fix Style Issues
fix:
@echo "\n==> Fix Style Issues:"
./vendor/bin/php-cs-fixer fix
## ci: Run CI Checks
ci: config clear composer lint test analyse
@echo "All quality checks passed"
## run: Run Walnut
run:
@echo "\n==> Run Walnut:"
$(SYMFONY) serve
## openapi: Build API
openapi:
@echo "\n==> Build API:"
$(PHP) ./bin/swagger
## installed: Show a list of installed packages
installed:
@echo "\n==> Show a list of installed packages:"
$(COMPOSER) show -i
## outdated: Show a list of outdated packages
outdated:
@echo "\n==> Show a list of outdated packages:"
$(COMPOSER) outdated
.PHONY: help