forked from BedrockStreaming/StatsdTagsPrometheusBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (80 loc) · 2.4 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
SHELL=bash
SOURCE_DIR = $(shell pwd)
BIN_DIR ?= ${SOURCE_DIR}/bin
COMPOSER_DIR = ${SOURCE_DIR}/composer
COMPOSER_BIN := $(shell type -P composer)
ifndef COMPOSER_BIN
COMPOSER_BIN = ${COMPOSER_DIR}/composer.phar
endif
define printSection
@printf "\033[36m\n==================================================\n\033[0m"
@printf "\033[36m $1 \033[0m"
@printf "\033[36m\n==================================================\n\033[0m"
endef
# BUILD
.PHONY: build
build: install quality test sf-security-checker
# BUILD CI
.PHONY: build-ci
build-ci: install quality test sf-security-checker
# INSTALL
.PHONY: install
install: clean-vendor clean-bin clean-composer composer-install
#CODE STYLE
.PHONY: quality
quality: cs-ci phpstan
# CLEAN for various directories used by Makefile.
.PHONY: clean-vendor
clean-vendor:
$(call printSection,CLEAN-VENDOR)
rm -rf ${SOURCE_DIR}/vendor
.PHONY: clean-bin
clean-bin:
$(call printSection,CLEAN-BIN)
rm -rf ${SOURCE_DIR}/bin
.PHONY: clean-composer
clean-composer:
$(call printSection,CLEAN-COMPOSER)
rm -rf ${SOURCE_DIR}/composer
rm -f ${SOURCE_DIR}/composer.install.log
rm -f ${SOURCE_DIR}/composer.lock
# COMPOSER
${COMPOSER_BIN}:
$(call printSection,COMPOSER-CLONE)
git clone https://github.m6web.fr/m6web/tool-composer.git ${COMPOSER_DIR}
COMPOSER_HOME=${COMPOSER_DIR}/composer-home
chmod 755 ${COMPOSER_BIN}
[ -L ${SOURCE_DIR}/composer.phar ] || ln -s ${COMPOSER_DIR}/composer.phar ${SOURCE_DIR}/composer.phar
.PHONY: composer-install
composer-install: ${SOURCE_DIR}/composer.install.log
${SOURCE_DIR}/composer.install.log: ${COMPOSER_BIN}
$(call printSection,COMPOSER-INSTALL)
$< --no-interaction install --ansi --no-progress --prefer-dist 2>&1 | tee ${SOURCE_DIR}/composer.install.log
# SECURITY CHECKER
.PHONY: sf-security-checker
sf-security-checker:
$(call printSection,COMPOSER-SECURITY-CHECKER)
php ${BIN_DIR}/security-checker security:check --ansi composer.lock
# TEST
.PHONY: test
test: phpunit
.PHONY: phpunit
phpunit:
$(call printSection,PHPUNIT)
${BIN_DIR}/phpunit
.PHONY: phpstan
phpstan:
${BIN_DIR}/phpstan.phar analyse
# QUALITY
.PHONY: cs
cs:
$(call printSection,CS)
${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --stop-on-violation --diff
.PHONY: cs-fix
cs-fix:
$(call printSection,CS-fix)
${BIN_DIR}/php-cs-fixer fix --ansi
.PHONY: cs-ci
cs-ci:
$(call printSection,CS-CI)
${BIN_DIR}/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose