forked from orvice/ss-panel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
98 lines (84 loc) · 3.15 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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="ss-panel" default="build">
<target name="build"
depends="prepare, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare,lint, tools-parallel, phpcpd, phpunit"/>
<property environment="env"/>
<target name="tools-parallel" description="Run tools in parallel">
<parallel threadCount="2">
<sequential>
<antcall target="phpmd"/>
</sequential>
<antcall target="phpcpd"/>
<antcall target="phpcs"/>
<antcall target="phploc"/>
<antcall target="phpdox"/>
</parallel>
</target>
<!-- Clean up from previous builds -->
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/app/cache"/>
</target>
<!-- Prepare for the new build -->
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/app/cache"/>
</target>
<!-- Lint the PHP files in app dir. Linting the whole ZF framework library takes forever -->
<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir="${basedir}/app">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>
<!-- PHPLoc (Lines Of Code) report -->
<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="./vendor/bin/phploc">
<arg value="--log-csv" />
<arg value="${basedir}/logs/phploc.csv" />
<arg path="${basedir}/app" />
</exec>
</target>
<!-- PHP Mess Detector -->
<target name="phpmd" description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="./vendor/bin/phpmd">
<arg path="${basedir}/app" />
<arg value="xml" />
<arg value="codesize,unusedcode,naming" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>
<!-- PHP Copy Paste Detector -->
<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="./vendor/bin/phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/app" />
</exec>
</target>
<!-- PHP Code Sniffer - tokenises PHP, JS and CSS files and detects violations of defined coding standards -->
<target name="phpcs" description="Check code with PHP Code Sniffer">
<exec executable="./vendor/bin/phpcs">
<arg value="-n" />
<arg path="${basedir}/app" />
</exec>
</target>
<!-- Kick off phpunit - this requires 3.4.1 because of assertType(), deprecated in 3.5.x and removed from 3.6.x. -->
<target name="phpunit">
<exec dir="./tests" executable="./vendor/bin/phpunit" failonerror="true" description="Run unit tests with PHPUnit">
<env key="app_ENV" value="testing"/>
<arg line="--verbose --stderr" />
</exec>
</target>
</project>