-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.xml
83 lines (75 loc) · 3.19 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="gbdb" basedir="." default="main">
<property name="tmp" value="/tmp" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<!-- Main Target -->
<target name="main" description="main target">
<trycatch property="exceptionmsg">
<try>
<phingcall target="startup" />
<phingcall target="ci-tasks" />
<phingcall target="shutdown" />
</try>
<catch>
<phingcall target="shutdown" />
<fail>Unexpected error during continuous integration tasks -- ${exceptionmsg}</fail>
</catch>
</trycatch>
</target>
<!-- Continuous Integration Tasks -->
<target name="ci-tasks" description="continuous integration tasks">
<!-- Create dirs -->
<mkdir dir="${builddir}/reports"/>
<!-- Call standard tasks -->
<phingcall target="php-cs-fixer-dryrun"/>
<phingcall target="phpcs"/>
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec executable="${srcdir}/vendor/bin/phpcbf" escape="false" passthru="true" checkreturn="true">
<arg line="--standard=${srcdir}/tests/phpcs.xml" />
</exec>
</target>
<target name="phpcs">
<exec executable="${srcdir}/vendor/bin/phpcs" escape="false">
<arg line="--standard=${srcdir}/tests/phpcs.xml --report=checkstyle > ${builddir}/reports/checkstyle.xml" />
</exec>
</target>
<target name="phpcs-console">
<exec executable="${srcdir}/vendor/bin/phpcs" escape="false" passthru="true" checkreturn="true">
<arg line="--standard=${srcdir}/tests/phpcs.xml" />
</exec>
</target>
<!-- php-cs-fixer (first task applies fixes, second task simply checks if they are needed) -->
<target name="php-cs-fixer">
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false">
<arg line="fix --config=${srcdir}/tests/gbdb.php-cs-fixer.php --verbose" />
</exec>
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false">
<arg line="fix --config=${srcdir}/tests/gbdb_templates.php-cs-fixer.php --verbose" />
</exec>
</target>
<target name="php-cs-fixer-dryrun">
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false" checkreturn="true">
<arg line="fix --config=${srcdir}/tests/gbdb.php-cs-fixer.php --dry-run --verbose --diff" />
</exec>
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false" checkreturn="true">
<arg line="fix --config=${srcdir}/tests/gbdb_templates.php-cs-fixer.php --dry-run --verbose --diff" />
</exec>
</target>
<!-- Set up dependencies -->
<target name="startup" description="set up dependencies">
<exec executable="composer">
<arg line="install" />
</exec>
</target>
<!-- Clean up -->
<target name="shutdown" description="clean up file system">
<delete dir="${srcdir}/vendor" includeemptydirs="true" failonerror="true" />
<exec command="git">
<arg line="reset --hard" />
</exec>
</target>
</project>