-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (62 loc) · 1.82 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
SHELL=bash -o pipefail
SOURCE_DIR = $(shell pwd)
BIN_DIR = ${SOURCE_DIR}/bin
COMPOSER = composer
define printSection
@printf "\033[36m\n==================================================\n\033[0m"
@printf "\033[36m $1 \033[0m"
@printf "\033[36m\n==================================================\n\033[0m"
endef
.PHONY: all
all: install quality test
.PHONY: ci
ci: quality test
.PHONY: install
install: clean-vendor composer-install
.PHONY: quality
quality: cs-ci phpstan rector
.PHONY: test
test: phpunit
.PHONY: rector
## Run rector in dry run mode
rector:
$(call printSection,TEST rector)
php ${BIN_DIR}/rector process src --dry-run
.PHONY: rector-fix
## Run rector
rector-fix:
$(call printSection,TEST rector-fix)
php ${BIN_DIR}/rector process src
### DEPENDENCIES ###
.PHONY: clean-vendor
clean-vendor:
$(call printSection,DEPENDENCIES clean)
rm -rf ${SOURCE_DIR}/vendor
.PHONY: composer-install
composer-install: ${SOURCE_DIR}/vendor/composer/installed.json
${SOURCE_DIR}/vendor/composer/installed.json:
$(call printSection,DEPENDENCIES install)
$(COMPOSER) --no-interaction install --ansi --no-progress --prefer-dist
### TEST ###
.PHONY: phpunit
phpunit:
$(COMPOSER) require webonyx/graphql-php
$(call printSection,TEST phpunit)
${BIN_DIR}/phpunit --exclude withoutGraphQLPackage
$(COMPOSER) remove webonyx/graphql-php
${BIN_DIR}/phpunit --group withoutGraphQLPackage
### QUALITY ###
.PHONY: phpstan
phpstan:
$(COMPOSER) require webonyx/graphql-php
$(call printSection,QUALITY phpstan)
${BIN_DIR}/phpstan analyse --memory-limit=1G
$(COMPOSER) remove webonyx/graphql-php
.PHONY: cs-ci
cs-ci:
$(call printSection,QUALITY php-cs-fixer check)
${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose
.PHONY: cs-fix
cs-fix:
$(call printSection,QUALITY php-cs-fixer fix)
${BIN_DIR}/php-cs-fixer fix