Development Guide

Setting up a build-job

To start, set up a new job:

10 Apr 2014 MB: I wish I had a clue how to tell Jenkins to not present me a german interface.

Setting up the checkouts

Here is how the two checkouts are configured:

The local module directory is noteworthy, the system under test - the ILIAS trunk in the above example - is checked out into the src directory of the ilias_ci checkout.
The checkout strategy is already at your discretion, however "svn update" brings good results since we don't put the sources upside down.

The builds

The build.xml file coming with the ilias_ci checkout contains a variety of targets. To make something happen, you need to add a build step to the job. The file provided is an Apache Ant buildfile, so you add a call to ant.
 
You see a configuration part like this:

The target is an important decision. The following targets are defined in the buildfile:

  • clean & prepare ( Preparation steps)
  • lint (PHPLint)
  • phploc (Lines of Code)
  • phpunit (Unit Test Execution)
  • phpmd (PHP Mess Detector)
  • phpcs (PHP Code Sniffer aka CheckStyle)
  • phpcpd (PHP Copy Paste Detector)
  • pdepend (PHP Depend)
  • phpcb (PHP Code Browser)
In addition to those, to overcome a general issue with these tools on Windows systems, the following targets are available for windows machines:
 
  • win-phploc
  • win-phpunit
  • win-phpmd
  • win-phpcs
  • win-phpcpd
  • win-pdepend
  • win-phpcb
You can configure your build by selecting the diagnostics you are interested in. Enter these into the build target input box.
(It is recommended to always start with clean and prepare, even though dependencies should make them the first targets executed.)

13 Apr 2014 MB: If you inspect the file, you will also see targets phpdox, inefficientsql and legacyconstructors. These are still considered experimental and will be added to the documentation once things work nicely.

Bundle-Builds

To make this a bit more convenient, a series of build targets exists, solely consisting of dependencies. These address common scenarios.
Here are the targets definitions, which should be self-explanatory:

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
<target name="build-full" depends="prepare, lint, phploc, pdepend, phpmd, phpcpd, legacyconstructors, inefficientsql, phpunit, phpcs, phpcb" />
 
<target name="win-build-full" depends="prepare, lint, win-phploc, win-phpunit, win-phpcb" />
 
<target name="build-quick" depends="prepare, lint, phploc, phpunit" />
 
<target name="win-build-quick" depends="prepare, lint, win-phploc, win-phpunit"/>
 
<target name="build-parallel-8" depends="prepare">
<parallel threadCount="8">
<antcall target="lint"/>
<antcall target="phploc"/>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
<antcall target="phpcpd"/>
<antcall target="phpunit"/>
<antcall target="phpcs"/>
</parallel>
<antcall target="phpcb"/>
</target>
 
<target name="win-build-parallel-8" depends="prepare">
<parallel threadCount="8">
<antcall target="lint"/>
<antcall target="win-phploc"/>
<antcall target="win-pdepend"/>
<antcall target="win-phpmd"/>
<antcall target="win-phpcpd"/>
<antcall target="win-phpunit"/>
<antcall target="win-phpcs"/>
</parallel>
<antcall target="win-phpcb"/>
</target>
 
<target name="build-parallel-4" depends="prepare">
<parallel threadCount="4">
<antcall target="lint"/>
<antcall target="phploc"/>
<antcall target="pdepend"/>
<antcall target="phpmd"/>
<antcall target="phpcpd"/>
<antcall target="phpunit"/>
<antcall target="phpcs"/>
</parallel>
<antcall target="phpcb"/>
</target>
 
<target name="win-build-parallel-4" depends="prepare">
<parallel threadCount="4">
<antcall target="lint"/>
<antcall target="win-phploc"/>
<antcall target="win-pdepend"/>
<antcall target="win-phpmd"/>
<antcall target="win-phpcpd"/>
<antcall target="win-phpunit"/>
<antcall target="win-phpcs"/>
</parallel>
<antcall target="win-phpcb"/>
</target>

The "quick" series of bundles does only a limited inspection, the intent is to catch definite defects as soon as possible. Such a job runs only for a few minutes and can give a direct feedback.
The "full" job takes many hours and it has to be checked on every machine, if it's a candidate for a daily or nightly job or if its better set up as a "BamS". Processing times beyond 30 hours were seen!
 
However, the build file gives you the full flexibility to build exactly what you are interested in.

BamS - Build am Sonntag