Skip to content

Commit

Permalink
Added initial configuration scripts for CI
Browse files Browse the repository at this point in the history
Also adapted the gitignore file to ignore files created on build.
  • Loading branch information
Philipp Frischmuth committed Jun 27, 2012
1 parent a0bbae7 commit 8ceffff
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
nbproject
*~
*.swp

cache.properties
build/api
build/code-browser
build/coverage
build/logs
build/pdepend
126 changes: 126 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="OntoWiki" default="build">
<target name="build" depends="prepare,lint,phploc,pdepend,phpmd-ci,phpcs-ci,phpcpd,phpdoc,phpunit,phpcb"/>

<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/api"/>
<delete dir="${basedir}/build/code-browser"/>
<delete dir="${basedir}/build/coverage"/>
<delete dir="${basedir}/build/logs"/>
<delete dir="${basedir}/build/pdepend"/>
</target>

<target name="prepare" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/api"/>
<mkdir dir="${basedir}/build/code-browser"/>
<mkdir dir="${basedir}/build/coverage"/>
<mkdir dir="${basedir}/build/logs"/>
<mkdir dir="${basedir}/build/pdepend"/>
</target>

<target name="lint" description="Perform syntax check of sourcecode files">
<apply executable="php" failonerror="true">
<arg value="-l" />

<fileset dir="${basedir}/application">
<include name="**/*.php" />
<modified />
</fileset>

<fileset dir="${basedir}/extensions">
<include name="**/*.php" />
<modified />
</fileset>
</apply>
</target>

<target name="phploc" description="Measure project size using PHPLOC">
<exec executable="phploc">
<arg value="--log-csv" />
<arg value="${basedir}/build/logs/phploc.csv" />
<arg path="${basedir}/application" />
<arg path="${basedir}/extensions" />
</exec>
</target>

<target name="pdepend" description="Calculate software metrics using PHP_Depend">
<exec executable="pdepend">
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
<arg path="${basedir}/application,${basedir}/extensions" />
</exec>
</target>

<target name="phpmd"
description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpmd">
<arg path="${basedir}/application,${basedir}/extensions" />
<arg value="text" />
<arg value="${basedir}/build/phpmd.xml" />
</exec>
</target>

<target name="phpmd-ci"
description="Perform project mess detection using PHPMD creating a log file for the continuous integration server">
<exec executable="phpmd">
<arg path="${basedir}/application,${basedir}/extensions" />
<arg value="xml" />
<arg value="${basedir}/build/phpmd.xml" />
<arg value="--reportfile" />
<arg value="${basedir}/build/logs/pmd.xml" />
</exec>
</target>

<target name="phpcs"
description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
<exec executable="phpcs">
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}/application" />
</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="phpcs" output="/dev/null">
<arg value="--report=checkstyle" />
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
<arg value="--standard=${basedir}/build/phpcs.xml" />
<arg path="${basedir}/application" />
</exec>
</target>

<target name="phpcpd" description="Find duplicate code using PHPCPD">
<exec executable="phpcpd">
<arg value="--log-pmd" />
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
<arg path="${basedir}/application" />
<arg path="${basedir}/extensions" />
</exec>
</target>

<target name="phpdoc" description="Generate API documentation using phpDocumentor">
<exec executable="phpdoc">
<arg value="--directory" />
<arg path="${basedir}/application" />
<arg value="--target" />
<arg path="${basedir}/build/api" />
</exec>
</target>

<target name="phpunit" description="Run unit tests with PHPUnit">
<exec executable="phpunit" failonerror="true"/>
</target>

<target name="phpcb" description="Aggregate tool output with PHP_CodeBrowser">
<exec executable="phpcb">
<arg value="--log" />
<arg path="${basedir}/build/logs" />
<arg value="--source" />
<arg path="${basedir}/application" />
<arg value="--output" />
<arg path="${basedir}/build/code-browser" />
</exec>
</target>
</project>
6 changes: 6 additions & 0 deletions build/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0"?>

<ruleset name="OntoWikiRuleSet">
<description>OntoWiki rule set for PHP_CodeSniffer</description>
<rule ref="Zend" />
</ruleset>
16 changes: 16 additions & 0 deletions build/phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>

<ruleset name="OntoWiki RuleSet"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/
ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>OntoWiki rule set for PHPMD</description>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
<rule ref="rulesets/codesize.xml/NPathComplexity" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/ExitExpression" /> <rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" /> <rule ref="rulesets/unusedcode.xml/UnusedPrivateField" /> <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
</ruleset>
19 changes: 19 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false" backupStaticAttributes="false" strict="true" verbose="true">
<testsuite name="OntoWiki">
<directory suffix="Test.php">application/tests</directory>
</testsuite>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-html" target="build/coverage" title="OntoWiki"/>
<log type="junit" target="build/logs/junit.xml"/>
</logging>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit 8ceffff

Please sign in to comment.