forked from metaregistrar/api-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-local.xml
More file actions
142 lines (121 loc) · 5.65 KB
/
build-local.xml
File metadata and controls
142 lines (121 loc) · 5.65 KB
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
<?xml version="1.0" encoding="UTF-8"?>
<project name="library-ci" default="build">
<target name="build" depends="prepare,composer-audit,php-lint-ci,phpmd-ci,phpcs-ci,phpstan-ci,phpunit-ci"/>
<!-- load environment variables into properties -->
<property environment="env"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="build/artifacts/coverage"/>
<delete dir="build/artifacts/logs"/>
</target>
<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="build/artifacts/coverage"/>
<mkdir dir="build/artifacts/logs"/>
</target>
<target name="composer-executable">
<exec executable="which" failonerror="false" outputproperty="which.composer.output">
<arg value="composer"/>
</exec>
<available file="${which.composer.output}" type="file" property="composer.global"/>
<available file="composer" property="composer.local"/>
<available file="composer.phar" property="composer-phar.local"/>
<condition property="composerexecutable" value="composer.phar">
<istrue value="${composer-phar.local}"/>
</condition>
<condition property="composerexecutable" value="composer" >
<and>
<isfalse value="${composer-phar.local}"/>
<istrue value="${composer.local}"/>
</and>
</condition>
<condition property="composerexecutable" value="${which.composer.output}" >
<and>
<isfalse value="${composer-phar.local}"/>
<isfalse value="${composer.local}"/>
<istrue value="${composer.global}"/>
</and>
</condition>
</target>
<target name="composer-install" depends="composer-executable" unless="composerexecutable">
<property name="composerexecutable" value="composer"/>
<get src="https://getcomposer.org/composer.phar" dest="${composerexecutable}"/>
</target>
<target name="composer-audit" description="Check for CVE's on installed libraries" depends="composer-install">
<exec executable="${composerexecutable}" failonerror="true">
<arg line="audit"/>
</exec>
</target>
<target name="get-changeset.php.raw" description="creates a list of php files separated by newline">
<pathconvert property="changeset.php.raw" pathsep="${line.separator}">
<fileset dir="src">
<include name="**/*.php"/>
<modified>
<param name="cache.cachefile" value="build/cache.properties"/>
</modified>
</fileset>
</pathconvert>
<!--Check if files are modified-->
<condition property="changeset.php.notempty">
<not>
<equals arg1="${changeset.php.raw}" arg2="" trim="true"/>
</not>
</condition>
</target>
<target name="get-changeset.php.spacesep" depends="get-changeset.php.raw" if="changeset.php.notempty"
description="Creates a quoted list of changed php files separated by spaces">
<loadresource property="changeset.php.spacesep">
<propertyresource name="changeset.php.raw"/>
<filterchain>
<tokenfilter delimoutput=" ">
<linetokenizer/>
<replaceregex pattern="^" replace='"'/>
<replaceregex pattern="$" replace='"'/>
</tokenfilter>
</filterchain>
</loadresource>
</target>
<target name="php-lint-ci" depends="get-changeset.php.spacesep" if="changeset.php.notempty"
description="Perform syntax check of sourcecode files in parallel">
<exec executable="sh" failonerror="true">
<arg value="-c"/>
<arg value="echo '${changeset.php.spacesep}' | xargs -n 1 -P 4 php -l 1>/dev/null"/>
</exec>
<echo message="OK"/>
</target>
<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="bin/phpmd" failonerror="true">
<arg path="src"/>
<arg value="text"/>
<arg value="phpmd.xml"/>
</exec>
</target>
<target name="phpcs-ci"
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="bin/phpcs" failonerror="true">
<arg value="--report=full"/>
<arg value="--standard=phpcs.xml"/>
<!-- Don't show warnings-->
<arg value="--warning-severity=0"/>
<arg value="--extensions=php"/>
<arg value="-s"/>
<arg path="src"/>
</exec>
</target>
<target name="phpstan-ci"
description="Find coding standard violations using PHP_CodeSniffer creating a log file for the continuous integration server">
<exec executable="bin/phpstan" failonerror="true">
<arg value="analyse"/>
<arg value="src"/>
<arg value="--level=1"/>
</exec>
</target>
<target name="phpunit-ci" description="Run unit tests with PHPUnit">
<exec executable="bin/phpunit" failonerror="true">
<arg line="--configuration=${basedir}/phpunit.xml"/>
<!--<arg line="--coverage-html=build/artifacts/coverage"/>-->
<arg line="--log-junit=build/artifacts/logs/junit.xml"/>
<!--<arg line="--coverage-clover=build/artifacts/logs/clover.xml"/>-->
<!--<arg line="--coverage-text"/>-->
</exec>
</target>
</project>