[icinga-checkins] icinga.org: icinga-web/master: Added jenkins build file

git at icinga.org git at icinga.org
Fri Oct 19 12:19:57 CEST 2012


Module: icinga-web
Branch: master
Commit: a737f8aaa1305c558e525ec9cac92deebeb62f76
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=a737f8aaa1305c558e525ec9cac92deebeb62f76

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Jul 12 15:37:08 2012 +0200

Added jenkins build file

---

 .gitignore            |    1 +
 AntBuild.xml          |  172 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/phpmd/phpmd.xml |   31 +++++++++
 3 files changed, 204 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index b15702f..3f2381b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,6 +45,7 @@ etc/conf.d/access.xml
 etc/conf.d/databases.xml
 etc/conf.d/Makefile
 etc/conf.d/sla.xml
+antbuild.log
 tests/phpunit/test.properties
 tests/php/results.xml
 etc/apache2/icinga-web.conf
diff --git a/AntBuild.xml b/AntBuild.xml
new file mode 100755
index 0000000..ac278fd
--- /dev/null
+++ b/AntBuild.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="icingaweb" default="build" basedir=".">
+
+<property name="testdir" value="${basedir}/app/modules" />
+
+<target name="init">
+  <record name="antbuild.log" loglevel="verbose" append="false"/>
+</target>
+
+ <target name="build"
+   depends="prepare,lint,phploc,pdepend,phpcs-ci,phpmd-ci,phpcpd,phpdoc,phpunit,phpcb,init"/>
+
+ <target name="build-parallel"
+   depends="init,prepare,lint,tools-parallel,phpunit,phpcb"/>
+
+<target name="tools-parallel"
+         description="Run tools in parallel"
+ depends="init">
+  <parallel threadCount="2">
+   <sequential>
+    <antcall target="pdepend"/>
+    <antcall target="phpmd-ci"/>
+   </sequential>
+   <antcall target="phpcpd"/>
+   <antcall target="phpcs-ci"/>
+   <antcall target="phploc"/>
+   <antcall target="phpdoc"/>
+  </parallel>
+ </target>
+
+ <target name="clean"
+  description="Clean up and create artifact directories"
+ depends="init">
+  <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"/>
+  <mkdir dir="${basedir}/build/phpdoc"/>
+ </target>
+
+ <target name="lint">
+  <apply executable="php" failonerror="true">
+   <arg value="-l" />
+
+   <fileset dir="${testdir}">
+    <include name="**/*.php" />
+    <exclude name="*/cache/*" />
+   </fileset>
+
+   <fileset dir="${basedir}/tests">
+    <include name="**/*.php" />
+   </fileset>
+  </apply>
+ </target>
+
+<target name="phploc" description="Measure project size using PHPLOC"
+ depends="init">
+  <exec executable="phploc">
+   <arg value="--log-csv" />
+   <arg value="${basedir}/build/logs/phploc.csv" />
+   <arg path="${testdir}" />
+  </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 value="--suffix=php" />
+   <arg value="--ignore=${basedir}/app/modules/AppKit/lib/context/AppKitApiProviderParser.class.php" />
+   <arg path="${testdir}" />
+  </exec>
+ </target>
+
+ <target name="phpmd"
+         description="Perform project mess detection using PHPMD"
+ depends="init">
+  <exec executable="phpmd">
+   <arg line="${testdir} text ${basedir}/tests/phpmd/phpmd.xml" />
+ 
+  </exec>
+ </target>
+
+ <target name="phpmd-ci"
+         description="Perform project mess detection using PHPMD" >
+  <exec executable="phpmd">
+   <arg line="${testdir} xml ${basedir}/tests/phpmd/phpmd.xml --suffixes php --reportfile ./build/logs/pmd.xml --exclude */cache/*" />
+  </exec>
+ </target>
+
+ <!--target name="phpdox"
+         description="Generate API documentation using phpDox">
+  <exec executable="phpdox"/>
+ </target-->
+
+ <target name="phpcs"
+         description="Find coding standard violations using PHP_CodeSniffer"
+ depends="init">
+  <exec executable="phpcs">
+   <arg value="--standard=${basedir}/tests/phpcs/YACS" />
+   <arg value="--ignore=cache,\.js$" />
+   <arg path="${testdir}" />
+  </exec>
+ </target>
+
+ <target name="phpcs-ci"
+         description="Find coding standard violations using PHP_CodeSniffer"
+ depends="init">
+  <exec executable="phpcs" output="/dev/null">
+   <arg value="--report=checkstyle" />
+   <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
+   <arg value="--standard=${basedir}/tests/phpcs/YACS" />
+   <arg value="--ignore=cache,\.js$" />
+   <arg path="${testdir}" />
+  </exec>
+ </target>
+
+<target name="phpcpd" description="Find duplicate code using PHPCPD"
+ depends="init">
+  <exec executable="phpcpd">
+   <arg value="--log-pmd" />
+   <arg value="${basedir}/build/logs/pmd-cpd.xml" />
+   <arg path="${testdir}" />
+  </exec>
+ </target>
+
+ <target name="phpdoc"
+          description="Generate API documentation using PHPDocumentor"
+ depends="init">
+  <exec executable="phpdoc">
+   <arg value="--directory" />
+   <arg path="${testdir}" />
+   <arg value="--target" />
+   <arg path="${basedir}/build/api" />
+  </exec>
+ </target>
+
+<target name="phpunit" depends="init">
+  <exec executable="phpunit" failonerror="false">
+  <arg line="--configuration ${basedir}/tests/phpunit/suites.xml
+             --coverage-clover ${basedir}/build/logs/clover.xml
+             --coverage-html ${basedir}/build/coverage
+             --exclude-group Database" />
+  </exec>
+ </target>
+
+ <target name="phpcb"
+         description="Aggregate tool output with PHP_CodeBrowser"
+ depends="init">
+  <exec executable="phpcb">
+   <arg value="--log" />
+   <arg path="${basedir}/build/logs" />
+   <arg value="--source" />
+   <arg path="${testdir}" />
+   <arg value="--output" />
+   <arg path="${basedir}/build/code-browser" />
+  </exec>
+ </target>
+
+</project>
diff --git a/tests/phpmd/phpmd.xml b/tests/phpmd/phpmd.xml
new file mode 100644
index 0000000..b501088
--- /dev/null
+++ b/tests/phpmd/phpmd.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<ruleset name="Icinga" 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>
+        Icinga Build Test
+    </description>
+    
+    <!-- Import des kompletten unused-code-rule set -->
+    <rule ref="rulesets/unusedcode.xml" />
+    
+    <!-- Import des cyclomatic-complexity-rule set, hoechster Prioritaet 
+        und mittlerer Report-Schwelle. -->
+    <rule ref="rulesets/codesize.xml/CyclomaticComplexity">
+        <priority>1</priority>
+        <properties>
+            <property name="reportLevel" value="5" />
+        </properties>
+    </rule>
+    
+    <!-- Import des kompletten naming-rule-set -->
+    <rule ref="rulesets/naming.xml"></rule>
+    
+    <!-- Import des kompletten design-rule-set -->
+    <rule ref="rulesets/design.xml">
+        <exclude name="ShortVariable" />
+        <exclude name="LongVariable" />
+    </rule>
+</ruleset>
\ No newline at end of file





More information about the icinga-checkins mailing list