-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.xml
120 lines (105 loc) · 3.83 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
<?xml version="1.0"?>
<project name="php_commons" default="build" basedir=".">
<!-- Download composer -->
<target name="download-composer"
description="Download composer">
<if>
<available file="composer.phar" type="file" />
<then>
<echo msg="File composer.phar already exists, skipping."/>
</then>
<else>
<exec
command="curl -s http://getcomposer.org/installer | php"
dir="."
passthru="true"
checkreturn="true"/>
</else>
</if>
</target>
<!-- Composer update-->
<target name="composer-update" depends="download-composer"
description="Run composer update">
<exec
command="php composer.phar update"
dir="."
passthru="true"
checkreturn="true"/>
</target>
<target name="exec-console-task">
<exec
command="vendor/hellworx/php_commons-4/bin/console --bootstrap src/bootstrap.php ${task}"
dir="."
passthru="true"
checkreturn="true"/>
</target>
<!-- Clean -->
<target name="clean"
description="Clean">
<delete dir="./test/results" includeemptydirs="true" verbose="true" />
<delete dir="./test/coverage" includeemptydirs="true" verbose="true" />
<delete dir="./test/tmp" includeemptydirs="true" verbose="true" />
</target>
<!-- Prepare -->
<target name="prepare" depends="composer-update"
description="Prepare">
<mkdir dir="./test/results"/>
<mkdir dir="./test/coverage"/>
<mkdir dir="./test/tmp"/>
</target>
<!-- Linter -->
<target name="linter">
<apply executable="php" failonerror="true">
<arg value="-l" />
<fileset dir=".">
<include name="**/*.php" />
<exclude name="vendor/" />
</fileset>
</apply>
</target>
<!-- Test -->
<target name="test" depends="prepare"
description="Unit testing">
<exec
command="phpunit --debug --bootstrap bootstrap.php --verbose --process-isolation --log-junit results/unittests.xml ."
dir="./test/"
passthru="true"
checkreturn="true"/>
</target>
<!-- Test with coverage -->
<target name="coverage" depends="prepare"
description="Unit testing">
<exec
command="phpunit --debug --bootstrap bootstrap.php --verbose --process-isolation --coverage-html coverage/ --log-junit results/unittests.xml ."
dir="./test/"
passthru="true"
checkreturn="true"/>
</target>
<!-- Examples -->
<target name="examples" depends=""
description="Execute examples">
<foreach param="filename" target="run-example">
<fileset dir="./examples">
<include name="example*.php" />
</fileset>
</foreach>
</target>
<target name="run-example" depends=""
description="Run example script">
<echo msg="Run ${filename}" />
<exec command="php ${filename}" dir="./examples" checkreturn="true" passthru="true" />
</target>
<!-- Create documentation -->
<target name="doc" depends=""
description="Create documentation">
<exec command="doxygen" dir="./doc" checkreturn="true" />
</target>
<!-- Build -->
<target name="build" depends="clean, prepare"
description="Build project">
</target>
<!-- Continous integration -->
<target name="ci" depends="clean, prepare, linter, test"
description="Continous integration">
</target>
</project>