-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild.xml
107 lines (98 loc) · 4.49 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="RecordManager" 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="basedir" value="${project.basedir}" override="true" />
<property name="srcdir" value="${basedir}/src/RecordManager" override="true" />
<property name="phpunit_extra_params" value="" />
<!-- Main Target -->
<target name="main" description="main target">
<echo>No main build target. Use qa-tasks for normal tests.</echo>
</target>
<!-- Quality Assurance Tasks -->
<target name="qa-tasks" description="Quality assurance tasks">
<phingcall target="phpunitfast"/>
<phingcall target="phpcs"/>
<phingcall target="php-cs-fixer-dryrun"/>
<phingcall target="psalm"/>
<phingcall target="phpstan-console"/>
</target>
<!-- Fix PHP Tasks -->
<target name="fix-php" description="quality assurance php tasks">
<phingcall target="php-cs-fixer"/>
<phingcall target="phpcbf"/>
</target>
<!-- PHPUnit -->
<target name="phpunit" description="Run tests with coverage reports">
<if>
<not><available type="dir" file="${builddir}/reports"/></not>
<then>
<mkdir dir="${builddir}/reports"/>
</then>
</if>
<if>
<not><available type="dir" file="${builddir}/reports/coverage"/></not>
<then>
<mkdir dir="${builddir}/reports/coverage"/>
</then>
</if>
<exec executable="${basedir}/vendor/bin/phpunit" passthru="true" checkreturn="true">
<arg line="-c ${basedir}/tests/phpunit.xml --display-deprecations --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${basedir}/tests ${phpunit_extra_params}" />
<env name="XDEBUG_MODE" value="coverage" />
</exec>
</target>
<target name="phpunitfast" description="Run tests">
<exec executable="${basedir}/vendor/bin/phpunit" passthru="true" checkreturn="true" >
<arg line="-c ${basedir}/tests/phpunit.xml --display-deprecations ${basedir}/tests ${phpunit_extra_params}" />
</exec>
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec executable="${basedir}/vendor/bin/phpcbf" escape="false" passthru="true" checkreturn="true">
<arg line="--standard=${basedir}/tests/phpcs.xml" />
</exec>
</target>
<target name="phpcs">
<exec executable="${basedir}/vendor/bin/phpcs" escape="false" passthru="true" checkreturn="true">
<arg line="-s --standard=${basedir}/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="${basedir}/vendor/bin/php-cs-fixer" passthru="true" escape="false">
<arg line="fix --config=${basedir}/tests/recordmanager.php-cs-fixer.php -vvv" />
</exec>
</target>
<target name="php-cs-fixer-dryrun">
<exec executable="${basedir}/vendor/bin/php-cs-fixer" passthru="true" escape="false" checkreturn="true">
<arg line="fix --config=${basedir}/tests/recordmanager.php-cs-fixer.php --dry-run -vvv --diff" />
</exec>
</target>
<!-- Report rule violations with PHPMD (mess detector) -->
<target name="phpmd">
<echo>Make sure you have phpmd installed in path. It's not installed by default due to its dependencies.</echo>
<exec executable="phpmd">
<arg line="${srcdir} html ${basedir}/tests/phpmd.xml --reportfile ${basedir}/reports/phpmd.html" />
</exec>
</target>
<!-- Psalm -->
<target name="psalm">
<exec executable="${basedir}/vendor/bin/psalm" escape="false" passthru="true" checkreturn="true">
<!-- threads=1 is a workaround for "Fatal error: Maximum execution time of 0 seconds exceeded" with macOS-->
<arg line="--threads=1 --diff" />
</exec>
</target>
<target name="psalm-info">
<exec executable="${basedir}/vendor/bin/psalm" escape="false" passthru="true" checkreturn="true">
<!-- threads=1 is a workaround for "Fatal error: Maximum execution time of 0 seconds exceeded" with macOS-->
<arg line="--threads=1 --diff --show-info=true" />
</exec>
</target>
<!-- Phpstan -->
<target name="phpstan-console">
<exec executable="${basedir}/vendor/bin/phpstan.phar" escape="false" passthru="true" checkreturn="true">
<arg line="--configuration=${basedir}/tests/phpstan.neon --memory-limit=2G analyse" />
</exec>
</target>
</project>