This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbuild.xml
192 lines (167 loc) · 8.14 KB
/
build.xml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0" encoding="UTF-8"?>
<project name="Ergonode" basedir="." default="build">
<autoloader autoloaderpath="${project.basedir}/vendor/autoload.php"/>
<property name="dir.src" value="${project.basedir}/src"/>
<property name="dir.module" value="${project.basedir}/module"/>
<property name="dir.build" value="${project.basedir}/build"/>
<property name="dir.docs" value="${dir.build}/docs"/>
<property name="dir.reports" value="${dir.build}/reports"/>
<property name="dir.console" value="bin/console"/>
<property name="APP_ENV" value="dev" />
<!-- Build -->
<target name="build" depends="cache:clear, create:directory, database:migrate" description="Standard build plan."/>
<target name="rebuild" depends="cache:clear, create:directory, database:drop, database:create, database:migrate, database:fixture" description="Standard build plan with database recreation."/>
<target name="rebuild:dev" depends="cache:clear, create:directory, database:drop, database:create, database:migrate, database:fixture:dev" description="Development build plan with database recreation."/>
<target name="rebuild:test" depends="cache:clear, create:directory, database:drop, database:create, database:migrate, database:fixture:test" description="Test build plan with database recreation."/>
<target name="rebuild:e2e" depends="cache:clear, create:directory, database:drop, database:create, database:migrate, database:fixture:e2e" description="Test e2e build plan with database recreation."/>
<!-- Create directories -->
<target name="create:directory" description="Create build directories.">
<echo msg="Creating build directories ..."/>
<mkdir dir="${dir.build}"/>
<mkdir dir="${dir.docs}"/>
<mkdir dir="${dir.reports}"/>
<mkdir dir="${dir.reports}/coverage"/>
</target>
<!-- Tests -->
<target
name="test"
depends="test:unit, test:behat"
description="Execute tests with database recreation."
>
</target>
<!-- PHP Unit -->
<target name="test:unit" description="Executes unit tests.">
<echo msg="Running unit tests..."/>
<exec command="bin/phpunit"
checkreturn="true"
logoutput="true"
passthru="true"
>
</exec>
</target>
<!-- PHP Unit coverage report-->
<target name="test:unit:coverage" description="Executes unit tests.">
<echo msg="Running unit tests..."/>
<exec command="bin/phpunit --coverage-clover=build/reports/phpunit-clover.xml --coverage-html=build/reports/coverage --log-junit=build/reports/phpunit-junit.xml"
checkreturn="true"
logoutput="true"
passthru="true"
>
</exec>
</target>
<!-- Infection -->
<target name="test:mutation" description="Executes infection mutation tests.">
<echo msg="Running mutation tests..."/>
<exec command="bin/infection --show-mutations"
checkreturn="false"
logoutput="true"
passthru="true"
>
</exec>
</target>
<!-- Behat -->
<target name="test:behat" depends="override:property:APP_ENV, cache:clear, database:drop, database:create, database:migrate, database:fixture:test" description="Executes behat tests." >
<echo msg="Running behat tests..."/>
<exec command="APP_ENV=${APP_ENV} APP_URL=http://localhost:8001 php -d error_reporting='E_ALL & ~E_DEPRECATED' bin/behat --colors --stop-on-failure --format=progress -vv"
checkreturn="true"
logoutput="true"
passthru="true"
>
</exec>
</target>
<!-- Cache -->
<target name="cache:clear" description="Clear cache">
<echo msg="Start clearing cache"/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} cache:clear " logoutput="true" checkreturn="true" />
</target>
<!-- Database -->
<target name="database:rebuild" depends="cache:clear, database:drop, database:create, database:migrate" description="Database rebuild"/>
<target name="database:migrate" description="Migrate migrations">
<echo msg="Executing database migrations..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} ergonode:migrations:migrate --no-interaction --allow-no-migration --quiet" logoutput="true" checkreturn="true" />
</target>
<target name="database:create" description="Create database">
<echo msg="Create database..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} doctrine:database:create --no-interaction" logoutput="true" checkreturn="true" />
</target>
<target name="database:drop" description="Drop database">
<echo msg="Drop database..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} doctrine:database:drop --if-exists --no-interaction --force" logoutput="true" checkreturn="true" />
</target>
<target name="database:fixture" description="Fill database with basic data">
<echo msg="Fill database with fixtures ..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} ergonode:fixture:load --no-interaction"
checkreturn="true"
logoutput="true">
</exec>
</target>
<target name="database:fixture:dev" description="Fill database with development data">
<echo msg="Fill database with dev fixtures ..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} ergonode:fixture:load -g develop --no-interaction"
checkreturn="true"
logoutput="true">
</exec>
</target>
<target name="database:fixture:test" description="Fill database with development data">
<echo msg="Fill database with dev fixtures ..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} ergonode:fixture:load -g test --no-interaction"
checkreturn="true"
logoutput="true">
</exec>
</target>
<target name="database:fixture:e2e" description="Fill database with e2e data">
<echo msg="Fill database with dev fixtures ..."/>
<exec command="APP_ENV=${APP_ENV} ${dir.console} ergonode:fixture:load -g e2e --no-interaction"
checkreturn="true"
logoutput="true">
</exec>
</target>
<!-- Code style check -->
<target name="check:style" depends="check:cs, check:phpstan, check:configs" description="Check code style"/>
<!-- PHP Stan check -->
<target name="check:phpstan" description="Executes unit tests.">
<echo msg="phpstan analyse ..."/>
<exec command="bin/phpstan analyse module"
checkreturn="true"
logoutput="true">
</exec>
</target>
<!-- PHP code style check -->
<target name="check:cs" description="PHPCS checker">
<exec command="bin/phpcs"
checkreturn="true"
logoutput="true">
</exec>
</target>
<!-- PHP code fix code style -->
<target name="check:cbf" description="PHPCBF fixer">
<exec command="bin/phpcbf"
checkreturn="true"
logoutput="true">
</exec>
</target>
<!-- PHP config files yaml check -->
<target name="check:configs" description="SF Yaml linter">
<exec command="APP_ENV=${APP_ENV} ${dir.console} lint:yaml config module --parse-tags"
checkreturn="true"
logoutput="true">
</exec>
</target>
<target name="check:dependencies" depends="check:dependencies:module" description="Check dependencies"/>
<target name="check:dependencies:module" description="Deptrac check dependencies">
<exec command="./bin/deptrac"
checkreturn="true"
logoutput="true">
</exec>
</target>
<target name="override:property:APP_ENV" description="Overrides APP_ENV property with test value">
<property name="APP_ENV" value="test" override="true" />
</target>
<!-- PHP files doc headers -->
<target name="check:doc" description="DocHeader checker">
<exec command="bin/docheader check config features module public src tests"
checkreturn="true"
logoutput="true">
</exec>
</target>
</project>