forked from NatLibFi/RecordManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
78 lines (70 loc) · 3.67 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
<?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>
<!-- 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 command="XDEBUG_MODE=coverage ${basedir}/vendor/bin/phpunit -c ${basedir}/tests/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${basedir}/tests ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>
<target name="phpunitfast" description="Run tests">
<exec command="${basedir}/vendor/bin/phpunit -c ${basedir}/tests/phpunit.xml ${basedir}/tests ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>
<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec command="${basedir}/vendor/bin/phpcbf --standard=${basedir}/tests/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="phpcs">
<exec command="${basedir}/vendor/bin/phpcs -s --standard=${basedir}/tests/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
</target>
<!-- php-cs-fixer (first task applies fixes, second task simply checks if they are needed) -->
<target name="php-cs-fixer">
<exec command="${basedir}/vendor/bin/php-cs-fixer fix --config=${basedir}/tests/recordmanager.php-cs-fixer.php -vvv" passthru="true" escape="false" />
</target>
<target name="php-cs-fixer-dryrun">
<exec command="${basedir}/vendor/bin/php-cs-fixer fix --config=${basedir}/tests/recordmanager.php-cs-fixer.php --dry-run -vvv --diff" passthru="true" escape="false" checkreturn="true" />
</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 command="phpmd ${srcdir} html ${basedir}/tests/phpmd.xml --reportfile ${basedir}/reports/phpmd.html" />
</target>
<!-- Psalm -->
<target name="psalm">
<exec command="${basedir}/vendor/bin/psalm --diff" escape="false" passthru="true" checkreturn="true" />
</target>
<target name="psalm-info">
<exec command="${basedir}/vendor/bin/psalm --diff --show-info=true" escape="false" passthru="true" checkreturn="true" />
</target>
<!-- Phpstan -->
<target name="phpstan-console">
<exec command="${basedir}/vendor/bin/phpstan.phar --configuration=${basedir}/tests/phpstan.neon --memory-limit=2G analyse" escape="false" passthru="true" checkreturn="true" />
</target>
</project>