jawira/phing-visualizer

View on GitHub
build.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>

<project name="PhingVisualizer" default="setup" phingVersion="3.0">

    <target name="setup" description="Prepare library for dev">
        <phingcall target="composer:install"/>
        <phingcall target="phive:install"/>
    </target>

    <target name="composer:install" description="Install dependencies">
        <composer command="install">
            <arg value="--no-interaction"/>
            <arg value="--prefer-dist"/>
        </composer>
    </target>

    <target name="composer:optimize" description="Install dependencies optimized for production environment">
        <composer command="install">
            <arg value="--no-dev"/>
            <arg value="--optimize-autoloader"/>
            <arg value="--prefer-dist"/>
        </composer>
    </target>

    <target name="composer:validate" description="Checks if composer.json is valid">
        <composer command="validate">
            <arg value="--strict"/>
        </composer>
    </target>

    <target name="phpunit:run" description="Run PHPUnit's tests" depends="composer:install, phive:install">
        <exec executable="bin/phpunit" passthru="true" checkreturn="true"/>
    </target>

    <target name="php:check-syntax" description="Check syntax on PHP files">
        <phplint haltonfailure="true">
            <fileset dir="${project.basedir}">
                <include name="src/**.php"/>
                <include name="tests/**.php"/>
            </fileset>
        </phplint>
    </target>

    <target name="test" description="Test library"
            depends="php:check-syntax, composer:validate, composer:install, phpstan:analyse, phpunit:run, behat:run"/>

    <target name="make:cc-test-reporter" description="Download CodeClimate test reporter">
        <exec command="make cc-test-reporter" passthru="true"/>
    </target>

    <target name="phive:install" description="Install PHPStan">
        <exec executable="phive" checkreturn="true" passthru="true">
            <arg value="install"/>
            <arg value="--trust-gpg-keys"/>
            <arg value="4AA394086372C20A,8E730BA25823D8B5,2420BAE0A3BE25C6,4AA394086372C20A"/>
        </exec>
    </target>

    <target name="code-climate:before" description="CodeClimate before build" depends="make:cc-test-reporter">
        <exec executable="${project.basedir}/cc-test-reporter" passthru="true">
            <arg value="before-build"/>
        </exec>
    </target>

    <target name="phpstan:analyse" description="Analyse source code" depends="phive:install">
        <exec executable="bin/phpstan" passthru="true" checkreturn="true">
            <arg value="--level=max"/>
            <arg value="--no-interaction"/>
            <arg value="--no-progress"/>
            <arg value="--debug"/>
            <arg value="analyse"/>
            <arg path="src/"/>
        </exec>
    </target>

    <target name="code-climate:after" description="CodeClimate after build" depends="make:cc-test-reporter">
        <exec executable="${project.basedir}/cc-test-reporter" passthru="true">
            <arg value="format-coverage"/>
            <arg value="--input-type=clover"/>
            <arg file="${project.basedir}/resources/coverage/clover.xml"/>
        </exec>
        <exec executable="${project.basedir}/cc-test-reporter" passthru="true">
            <arg value="upload-coverage"/>
        </exec>
    </target>

    <target name="behat:run" description="Run Behat tests" depends="composer:install">
        <exec executable="vendor/bin/behat" checkreturn="true" passthru="true">
            <arg value="--stop-on-failure"/>
        </exec>
    </target>

    <target name="git:tags" description="List all git tags">
        <!--https://stackoverflow.com/a/34239190/4345061-->
        <exec executable="git" passthru="true">
            <arg value="log"/>
            <arg line="--graph --all --decorate --oneline --simplify-by-decoration"/>
        </exec>
    </target>

    <target name="changelog:links" description="Update links in composer.json">
        <composer command="require">
            <arg value="symplify/changelog-linker"/>
        </composer>
        <exec executable="vendor/bin/changelog-linker">
            <arg value="link"/>
        </exec>
        <composer command="remove">
            <arg value="symplify/changelog-linker"/>
        </composer>
    </target>
</project>