-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (86 loc) · 3.15 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
COLOR_ENABLED ?= true
TEST_OUTPUT_STYLE ?= dot
COVERAGE_OUTPUT_STYLE ?= html
## DIRECTORY AND FILE
BUILD_DIRECTORY ?= build
REPORTS_DIRECTORY ?= ${BUILD_DIRECTORY}/reports
COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/coverage
BEHAT_COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/behat-coverage
COVERAGE_CLOVER_FILE_PATH ?= ${COVERAGE_DIRECTORY}/clover.xml
## Commands options
### Composer
#COMPOSER_OPTIONS=
### Phpcs
PHPCS_REPORT_STYLE ?= full
PHPCS_DISABLE_WARNING ?= "false"
#PHPCS_REPORT_FILE=
#PHPCS_REPORT_FILE_OPTION=
# Enable/Disable color ouput
ifeq ("${COLOR_ENABLED}","true")
PHPUNIT_COLOR_OPTION ?= --colors=always
BEHAT_COLOR_OPTION ?= --colors
PHPCS_COLOR_OPTION ?= --colors
COMPOSER_COLOR_OPTION ?= --ansi
else
PHPUNIT_COLOR_OPTION ?= --colors=never
PHPCS_COLOR_OPTION ?= --no-colors
BEHAT_COLOR_OPTION ?= --no-colors
COMPOSER_COLOR_OPTION ?= --no-ansi
endif
ifeq ("${TEST_OUTPUT_STYLE}","pretty")
PHPUNIT_OUTPUT_STYLE_OPTION ?= --testdox
BEHAT_OUTPUT_STYLE_OPTION ?= --format pretty
else
PHPUNIT_OUTPUT_STYLE_OPTION ?=
BEHAT_OUTPUT_STYLE_OPTION ?= --format progress
endif
ifeq ("${COVERAGE_OUTPUT_STYLE}","clover")
PHPUNIT_COVERAGE_OPTION ?= --coverage-clover ${COVERAGE_CLOVER_FILE_PATH}
else
ifeq ("${COVERAGE_OUTPUT_STYLE}","html")
PHPUNIT_COVERAGE_OPTION ?= --coverage-html ${COVERAGE_DIRECTORY}
else
PHPUNIT_COVERAGE_OPTION ?= --coverage-text
endif
endif
ifneq ("${PHPCS_REPORT_FILE}","")
PHPCS_REPORT_FILE_OPTION ?= --report-file=${PHPCS_REPORT_FILE}
endif
ifneq ("${PHPCS_DISABLE_WARNING}","true")
PHPCS_DISABLE_WARNING_OPTION=
else
PHPCS_DISABLE_WARNING_OPTION=-n
endif
## Project build (install and configure)
build: install configure
## Project installation
install:
composer install ${COMPOSER_COLOR_OPTION} ${COMPOSER_OPTIONS} --prefer-dist --no-suggest --no-interaction
## project Configuration
configure:
# Project tests
test:
make test-functional
make test-technical
make codestyle
test-technical:
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite technical
test-functional:
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} --testsuite functional
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets
codestyle: create-reports-directory
./vendor/bin/phpcs ${PHPCS_DISABLE_WARNING_OPTION} --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
coverage: create-coverage-directory
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} ${PHPUNIT_COVERAGE_OPTION}
behat-coverage: create-behat-coverage-directory
composer required leanphp/behat-code-coverage
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets --profile coverage
# Internal commands
create-coverage-directory:
mkdir -p ${COVERAGE_DIRECTORY}
create-behat-coverage-directory:
mkdir -p ${BEHAT_COVERAGE_DIRECTORY}
create-reports-directory:
mkdir -p ${REPORTS_DIRECTORY}
.PHONY: build install configure test test-technical test-functional codestyle coverage behat-coverage create-coverage-directory create-behat-coverage-directory create-reports-directory
.DEFAULT: build