|
| 1 | +<?xml version="1.0"?> |
| 2 | +<project name="ovh/ovh" default="all"> |
| 3 | + <property name="base" value="${project.basedir}/" /> |
| 4 | + <property environment="env" /> |
| 5 | + |
| 6 | + <if> |
| 7 | + <available file="${base}build.properties" property="" /> |
| 8 | + <then> |
| 9 | + <property file="${base}build.properties" override="true" /> |
| 10 | + </then> |
| 11 | + </if> |
| 12 | + |
| 13 | +<!--##########################################################################################################--> |
| 14 | + <target name="help"> |
| 15 | + <echo message="${phing.project.name} on [${git.branch}]" /> |
| 16 | + <echo message=" Available commands are:" /> |
| 17 | + <echo message=" test -> Run unit tests" /> |
| 18 | + <echo message=" clean -> Clean current environment" /> |
| 19 | + <echo message=" server -> Launch PHP built-in server" /> |
| 20 | + <echo message=" watch -> Run precommit task on every file changed" /> |
| 21 | + <echo message=" precommit -> Source code validation before commit" /> |
| 22 | + <echo message=" Specific tools tasks:" /> |
| 23 | + <echo message=" phpcs -> Run PHP Code Sniffer" /> |
| 24 | + <echo message=" phplint -> Run PHP Lint" /> |
| 25 | + <echo message=" phpdocs -> Run PHP Documentor" /> |
| 26 | + <echo message=" phpunit -> Run PHPUnit" /> |
| 27 | + </target> |
| 28 | +<!--##########################################################################################################--> |
| 29 | + <target name="test" description="Run unit tests"> |
| 30 | + <phingcall target="phpunit" /> |
| 31 | + </target> |
| 32 | + <target name="clean" description="Clean current environment"> |
| 33 | + <delete dir="docs" includeemptydirs="true" verbose="true" failonerror="true" /> |
| 34 | + </target> |
| 35 | + <target name="precommit" description="Source code validation before commit"> |
| 36 | + <phingcall target="phplint" /> |
| 37 | + <phingcall target="phpcs" /> |
| 38 | + <phingcall target="phpunit" /> |
| 39 | + </target> |
| 40 | + <target name="all" description="Make a full integration check"> |
| 41 | + <phingcall target="phplint" /> |
| 42 | + <phingcall target="phpcs" /> |
| 43 | + <phingcall target="phpunit" /> |
| 44 | + <phingcall target="phpdocs" /> |
| 45 | + </target> |
| 46 | +<!--##########################################################################################################--> |
| 47 | + <target name="phpcs" description="Run PHP Code Sniffer"> |
| 48 | + <phpcodesniffer |
| 49 | + standard="PSR2" |
| 50 | + format="summary" |
| 51 | + > |
| 52 | + <fileset dir="."> |
| 53 | + <include name="src/**/*.php"/> |
| 54 | + <include name="test/**/*.php"/> |
| 55 | + </fileset> |
| 56 | + </phpcodesniffer> |
| 57 | + </target> |
| 58 | + <target name="phpcbf" description="Run PHP Code Sniffer"> |
| 59 | + <exec command="vendor/bin/phpcbf --standard=PSR2 src" logoutput="true" /> |
| 60 | + </target> |
| 61 | + <target name="phplint" description="Run PHP Lint"> |
| 62 | + <phplint deprecatedAsError="true"> |
| 63 | + <fileset dir="."> |
| 64 | + <include name="src/**/*.php"/> |
| 65 | + <include name="test/**/*.php"/> |
| 66 | + </fileset> |
| 67 | + </phplint> |
| 68 | + </target> |
| 69 | + <target name="phpdocs" description="Run PHP Documentor" depends="clean"> |
| 70 | + <if> |
| 71 | + <not><available file="docs" /></not> |
| 72 | + <then> |
| 73 | + <mkdir dir="docs" /> |
| 74 | + </then> |
| 75 | + </if> |
| 76 | + |
| 77 | + <phpdoc2 destdir="docs"> |
| 78 | + <fileset dir="src"> |
| 79 | + <include name="**/*.php" /> |
| 80 | + </fileset> |
| 81 | + </phpdoc2> |
| 82 | + </target> |
| 83 | + <target name="phpunit" description="Run PHPUnit"> |
| 84 | + <if> |
| 85 | + <and> |
| 86 | + <isset property="only.units" /> |
| 87 | + <equals arg1="${only.units}" arg2="true" /> |
| 88 | + </and> |
| 89 | + <then> |
| 90 | + <fileset dir="tests" id="tests"> |
| 91 | + <include name="ApiTest.php"/> |
| 92 | + </fileset> |
| 93 | + </then> |
| 94 | + <else> |
| 95 | + <fileset dir="tests" id="tests"> |
| 96 | + <include name="**/*.php"/> |
| 97 | + </fileset> |
| 98 | + </else> |
| 99 | + </if> |
| 100 | + |
| 101 | + <phpunit |
| 102 | + haltonfailure="true" |
| 103 | + haltonerror="true" |
| 104 | + bootstrap="tests/bootstrap.php" |
| 105 | + printsummary="true" |
| 106 | + > |
| 107 | + <formatter type="plain" usefile="false"/> |
| 108 | + <batchtest> |
| 109 | + <fileset refid="tests" /> |
| 110 | + </batchtest> |
| 111 | + </phpunit> |
| 112 | + </target> |
| 113 | +<!--##########################################################################################################--> |
| 114 | +</project> |
0 commit comments