forked from phpro/zf-smartcrud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
100 lines (85 loc) · 3.32 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="PhproSmartCrud" default="build">
<target name="travis" depends="run-validation-tests,show-test-results" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/test-results"/>
<mkdir dir="${basedir}/build/cs-results"/>
</target>
<target name="phpcs" description="Runs PHP CodeSniffer" depends="prepare">
<check-cs/>
</target>
<target name="phpspec" description="Run Phpspec tests" depends="prepare">
<component-test/>
</target>
<target name="composer-install" description="Installs dependencies via composer install">
<sequential>
<exec executable="composer" failonerror="true">
<arg value="self-update" />
</exec>
<exec executable="composer" failonerror="true">
<arg value="--version" />
</exec>
<exec executable="composer" failonerror="true">
<env key="COMPOSER_ROOT_VERSION" value="dev-master"/>
<arg value="install" />
<arg value="--dev" />
<arg value="--prefer-dist" />
</exec>
</sequential>
</target>
<target
name="run-validation-tests"
depends="prepare,composer-install"
description="Run tests for the various components in parallel"
>
<parallel threadCount="2">
<component-test/>
<check-cs/>
</parallel>
</target>
<target name="show-test-results" description="Display logged test results">
<concat>
<fileset dir="${basedir}/build/cs-results/"/>
<fileset dir="${basedir}/build/test-results/"/>
</concat>
</target>
<macrodef name="component-test">
<sequential>
<echo output="${basedir}/build/test-results/phpspec.log" level="debug">
Validating Business logica with PhpSpec
</echo>
<exec
executable="${basedir}/vendor/bin/phpspec"
output="${basedir}/build/test-results/phpspec.log"
error="${basedir}/build/test-results/phpspec.log"
failonerror="true"
append="true"
>
<arg value="run" />
<arg value="-fpretty" />
</exec>
</sequential>
</macrodef>
<macrodef name="check-cs">
<sequential>
<echo output="${basedir}/build/cs-results/check-cs.log" level="debug">
Validating Coding standards with PhpCsFixer
</echo>
<exec executable="${basedir}/vendor/bin/php-cs-fixer"
output="${basedir}/build/test-results/check-cs.log"
error="${basedir}/build/test-results/check-cs.log"
failonerror="true"
append="true"
>
<arg value="fix" />
<arg value="--level=psr2" />
<arg value="-v" />
<arg value="--dry-run" />
<arg value="${basedir}" />
</exec>
</sequential>
</macrodef>
</project>