forked from tsteur/open-source-tag-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·422 lines (368 loc) · 15.8 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<project name="Tag Admin Backend Build" default="info">
<property name="bindir" value="${basedir}/bin"/>
<property name="builddir" value="${basedir}/build" />
<property name="sourcedir" value="${basedir}/src" />
<property name="appdir" value="${basedir}/app" />
<property name="webdir" value="${basedir}/web" />
<condition property="global-env-prod" value="true" else="false">
<equals arg1="${env}" arg2="prod"></equals>
</condition>
<condition property="global-env" value="prod" else="dev">
<equals arg1="${env}" arg2="prod"></equals>
</condition>
<target name="info">
<java classname="org.apache.tools.ant.Main">
<arg value="-projecthelp" />
<arg value="-buildfile" />
<arg value="${ant.file}" />
</java>
</target>
<target name="clean">
<delete dir="${builddir}" />
</target>
<target name="prepare">
<mkdir dir="${bindir}" />
<mkdir dir="${builddir}/tests-reports" />
<mkdir dir="${builddir}/logs" />
<mkdir dir="${builddir}/coverage" />
<mkdir dir="${webdir}/container-debugger" />
</target>
<target name="composer-download" description="Download composer from www.getcomposer.org">
<exec executable="bash" failonerror="true">
<arg value="-c" />
<arg value="curl -sS https://getcomposer.org/installer | php -- --install-dir=${bindir} --filename=composer" />
</exec>
</target>
<target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer and print result in text format">
<exec executable="${bindir}/phpcs" failonerror="true">
<arg value="--standard=${basedir}/phpcs.xml" />
<arg value="--extensions=php" />
<arg path="${sourcedir}" />
</exec>
</target>
<target name="license" description="Find source files without information about license.">
<exec executable="${appdir}/license" failonerror="true"></exec>
</target>
<target name="phpcs-ci" description="Find coding standard violations using PHP_CodeSniffer and print result in text format and log result in XML and HTML format">
<exec executable="${bindir}/phpcs" failonerror="true">
<arg value="--standard=${basedir}/phpcs.xml" />
<arg value="--extensions=php" />
<arg value="--report=checkstyle" />
<arg value="--report-file=${builddir}/logs/checkstyle.xml" />
<arg path="${sourcedir}" />
</exec>
</target>
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="${bindir}/phploc">
<arg value="--log-csv" />
<arg value="${builddir}/logs/phploc.csv" />
<arg path="${sourcedir}" />
</exec>
</target>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<!--<sequential>-->
<!--<antcall target="phpmd" />-->
<!--<antcall target="phpmd-ci" />-->
<!--</sequential>-->
<sequential>
<antcall target="phpcs" />
<antcall target="phpcs-ci" />
<antcall target="eslint" />
</sequential>
<antcall target="phploc" />
</parallel>
</target>
<target name="phpmd" description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="${bindir}/phpmd" failonerror="true">
<arg path="${sourcedir}" />
<arg value="text" />
<arg value="${basedir}/phpmd.xml" />
</exec>
</target>
<target name="phpmd-ci" description="Perform project mess detection using PHPMD and log result in html format">
<exec executable="${bindir}/phpmd" failonerror="true">
<arg path="${sourcedir}" />
<arg value="xml" />
<arg value="${basedir}/phpmd.xml" />
<arg line="--reportfile ${builddir}/logs/phpmd.xml" />
</exec>
</target>
<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="${bindir}/phpunit" failonerror="true">
<arg value="-c" />
<arg path="${basedir}/phpunit.xml" />
<arg line="--log-junit ${builddir}/tests-reports/phpunit.xml" />
</exec>
</target>
<target name="behat" description="Run behat tests">
<exec executable="${bindir}/behat" failonerror="true">
<arg value="-c" />
<arg path="${basedir}/behat.yml" />
</exec>
</target>
<target name="vendors" description="Installing composer dependencies">
<antcall target="vendors-dev" />
<antcall target="vendors-prod" />
</target>
<target name="vendors-prod" if="${global-env-prod}" description="Installing composer dependencies">
<exec executable="${bindir}/composer" failonerror="true">
<env key="SYMFONY_ENV" value="prod" />
<arg value="install" />
<arg value="--prefer-dist" />
<arg value="--no-dev" />
</exec>
</target>
<target name="vendors-dev" unless="${global-env-prod}" description="Installing composer dependencies">
<exec executable="${bindir}/composer" failonerror="true">
<arg value="install" />
<arg value="--prefer-dist" />
</exec>
</target>
<target name="configuration" description="Copy parameters">
<exec executable="cp" failonerror="true">
<arg path="phpmd.xml.dist" />
<arg path="phpmd.xml" />
</exec>
<exec executable="cp" failonerror="true">
<arg path="phpunit.xml.dist" />
<arg path="phpunit.xml" />
</exec>
<exec executable="cp" failonerror="true">
<arg path="phpcs.xml.dist" />
<arg path="phpcs.xml" />
</exec>
<exec executable="cp" failonerror="true">
<arg path="behat.yml.dist" />
<arg path="behat.yml" />
</exec>
</target>
<target name="npm-install" description="Install npm dependencies for project">
<exec executable="npm" failonerror="true">
<arg value="install" />
</exec>
</target>
<target name="eslint" description="Static analysis of coding standards for javascript files">
<exec executable="./node_modules/.bin/gulp" failonerror="true">
<arg value="lint" />
</exec>
</target>
<target name="bower-install" description="Install bower dependencies for project">
<exec executable="./node_modules/.bin/bower" failonerror="true">
<arg value="install" />
<arg value="--force-latest" />
<arg value="--allow-root" />
</exec>
</target>
<target name="webdriver-update" description="Install/Update the latest version of webdriver for e2e tests">
<exec executable="./node_modules/.bin/gulp" failonerror="true">
<arg value="webdriver:update" />
</exec>
</target>
<target name="build-frontend" description="Build frontend application in provided environment">
<exec executable="./node_modules/.bin/gulp" failonerror="true">
<arg value="build" />
</exec>
</target>
<target name="karma-unit" description="Run unit tests for javascript source code without containerjs source">
<exec executable="./node_modules/.bin/gulp" failonerror="true">
<arg value="test" />
</exec>
</target>
<target name="npm-install-containerjs">
<exec executable="npm" dir="${basedir}/containerjs" failonerror="true">
<arg value="install" />
</exec>
</target>
<target name="karma-containerjs-unit">
<exec executable="./node_modules/.bin/gulp" dir="${basedir}/containerjs" failonerror="true">
<arg value="tests:unit" />
</exec>
</target>
<target name="saucelabs-debugger">
<exec executable="./node_modules/.bin/gulp" dir="${basedir}" failonerror="true">
<arg value="tests:debugger-unit:multiBrowsers" />
</exec>
</target>
<target name="saucelabs-adminpanel">
<exec executable="./node_modules/.bin/gulp" dir="${basedir}" failonerror="true">
<arg value="tests:admin-unit:multiBrowsers" />
</exec>
</target>
<target name="saucelabs-containerjs">
<exec executable="./node_modules/.bin/gulp" dir="${basedir}/containerjs" failonerror="true">
<arg value="tests:unit:multiBrowsers" />
</exec>
</target>
<target name="composer-post-hook">
<exec executable="${bindir}/composer" failonerror="true">
<env key="SYMFONY_ENV" value="${global-env}" />
<arg value="run-script" />
<arg value="post-install-cmd" />
</exec>
</target>
<target name="download-frontend-dependencies" description="Download frontend dependencies">
<parallel threadCount="2">
<antcall target="bower-install" />
<antcall target="webdriver-update" />
</parallel>
</target>
<target name="tsc-build" description="build typescript files">
<exec executable="./node_modules/.bin/tsc" failonerror="false">
<arg value="-p"></arg>
<arg value="./"></arg>
</exec>
</target>
<target name="e2e" description="Run e2e tests">
<exec executable="npm" failonerror="true">
<arg value="run-script"></arg>
<arg value="e2e"></arg>
</exec>
</target>
<target name="container-mock" description="build container mock for tests">
<exec executable="./bin/console">
<arg value="container:generate:js"></arg>
<arg value="43"></arg>
<arg value="--env=test"></arg>
</exec>
</target>
<target name="container-mock-for-debugger-e2e-tests" description="build container mock for e2e debugger tests">
<exec executable="./bin/console">
<arg value="container:generate:js"></arg>
<arg value="1"></arg>
</exec>
</target>
<target name="tag-tree-mock" description="build tag tree mock for tests">
<exec executable="./bin/console">
<arg value="container:generate:tag-tree"></arg>
<arg value="43"></arg>
<arg value="--env=test"></arg>
</exec>
</target>
<target name="generate-database-scheme" description="generate database with scheme">
<exec executable="./bin/console">
<arg value="cache:clear"></arg>
<arg value="--env=test"></arg>
</exec>
<exec executable="./bin/console">
<arg value="doctrine:schema:create"></arg>
<arg value="--env=test"></arg>
</exec>
</target>
<target name="load-fixtures" description="load fixtures for tests">
<exec executable="./bin/console">
<arg value="doctrine:fixtures:load"></arg>
<arg value="--no-interaction"></arg>
<arg value="--env=test"></arg>
</exec>
</target>
<target name="clear-database" description="clear database">
<exec executable="./bin/console">
<arg value="doctrine:database:drop"></arg>
<arg value="--force"></arg>
</exec>
<exec executable="./bin/console">
<arg value="doctrine:database:create"></arg>
</exec>
<exec executable="./bin/console">
<arg value="doctrine:schema:create"></arg>
</exec>
</target>
<target name="load-fixtures-for-e2e-debugger-tests" description="Load fixtures for e2e debugger tests">
<exec executable="./bin/console">
<arg value="doctrine:fixtures:load"></arg>
<arg value="--fixtures=src/SevenTag/Api/TestBundle/DataFixtures/e2e-debugger"></arg>
<arg value="--no-interaction"></arg>
</exec>
</target>
<target name="e2e-debugger" description="Run e2e tests for debugger" depends="clear-database,load-fixtures-for-e2e-debugger-tests,container-mock-for-debugger-e2e-tests">
<exec executable="./node_modules/.bin/gulp" failonerror="true">
<arg value="tests:e2e-debugger" />
</exec>
</target>
<target name="doctrine-schema-dump">
<exec executable="${bindir}/console" failonerror="true" output="${basedir}/app/Resources/schema.sql">
<arg value="doctrine:schema:create"></arg>
<arg value="--dump-sql"></arg>
</exec>
</target>
<target name="build" description="Run build">
<parallel threadCount="2">
<sequential>
<antcall target="common" />
<antcall target="vendors" />
</sequential>
<sequential>
<antcall target="npm-install" />
<antcall target="tsc-build" />
<antcall target="download-frontend-dependencies" />
<antcall target="build-frontend" />
<antcall target="composer-post-hook" />
</sequential>
</parallel>
</target>
<target name="tests-task" description="Run tests">
<parallel threadCount="2">
<antcall target="npm-install-containerjs" />
<sequential>
<antcall target="phpunit" />
<antcall target="generate-database-scheme" />
<antcall target="load-fixtures" />
<antcall target="container-mock" />
<antcall target="tag-tree-mock" />
<antcall target="karma-unit" />
<antcall target="karma-containerjs-unit" />
<antcall target="behat" />
</sequential>
</parallel>
</target>
<target name="e2e-selenium-firefox" description="run e2e tests on docker selenium">
<parallel threadCount="2">
<sequential>
<!--<antcall target="build" />-->
<antcall target="prepare-db" />
<antcall target="e2e-selenium-task-firefox" />
</sequential>
</parallel>
</target>
<target name="e2e-selenium-chrome" description="run e2e tests on docker selenium">
<parallel threadCount="2">
<sequential>
<!--<antcall target="build" />-->
<antcall target="prepare-db" />
<antcall target="e2e-selenium-task-chrome" />
</sequential>
</parallel>
</target>
<target name="prepare-db">
<exec executable="./bin/console">
<arg value="doctrine:schema:update"></arg>
<arg value="--force"></arg>
</exec>
<exec executable="./bin/console">
<arg value="doctrine:migrations:migrate"></arg>
<arg value="--no-interaction"></arg>
</exec>
<exec executable="./bin/console">
<arg value="doctrine:fixtures:load"></arg>
<arg value="--no-interaction"></arg>
</exec>
<exec executable="./bin/console">
<arg value="c:c"></arg>
<arg value="--env=prod"></arg>
</exec>
</target>
<target name="e2e-selenium-task-chrome" description="run e2e tests on docker selenium">
<exec executable="./node_modules/.bin/gulp">
<arg value="tests:e2e-admin-selenium-chrome"></arg>
</exec>
</target>
<target name="e2e-selenium-task-firefox" description="run e2e tests on docker selenium">
<exec executable="./node_modules/.bin/gulp">
<arg value="tests:e2e-admin-selenium-firefox"></arg>
</exec>
</target>
<target name="common" depends="clean,prepare,configuration,composer-download" />
<target name="coding-standards" depends="license,tools-parallel" />
<target name="tests" depends="build,coding-standards,tests-task" />
</project>