Skip to content

Commit ac9d05e

Browse files
committed
Add a build-jenkins.xml
1 parent 60d6938 commit ac9d05e

File tree

3 files changed

+178
-0
lines changed

3 files changed

+178
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ before_script:
1616

1717
script:
1818
- ant
19+
- phpunit --configuration phpunit.travis.xml

build-jenkins.xml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project name="joomla-tracker" default="build" basedir=".">
4+
<property name="source" value="src" />
5+
<property name="cli" value="cli" />
6+
<property name="joomlasource" value="cli,src" />
7+
<property name="testsource" value="" />
8+
9+
<condition property="script-suffix" value=".bat" else="">
10+
<os family="windows" />
11+
</condition>
12+
13+
<condition property="script-null" value="NUL" else="/dev/null">
14+
<os family="windows" />
15+
</condition>
16+
17+
<target name="clean" description="Clean up and create artifact directories">
18+
<delete dir="${basedir}/build/api" />
19+
<delete dir="${basedir}/build/coverage" />
20+
<delete dir="${basedir}/build/logs" />
21+
<delete dir="${basedir}/build/pdepend" />
22+
<delete dir="${basedir}/htmlreports/API_Documentation" />
23+
24+
<mkdir dir="${basedir}/build/api" />
25+
<mkdir dir="${basedir}/build/coverage" />
26+
<mkdir dir="${basedir}/build/logs" />
27+
<mkdir dir="${basedir}/build/pdepend" />
28+
<mkdir dir="${basedir}/htmlreports/API_Documentation" />
29+
</target>
30+
31+
<target name="installdep" description="Install build dependencies using composer">
32+
<exec executable="composer">
33+
<arg value="update" />
34+
<arg value="--dev" />
35+
</exec>
36+
</target>
37+
38+
<target name="parallelTasks" description="Run the pdepend, phpmd, phpcpd, phpcs, phpdoc and phploc tasks in parallel using a maximum of 2 threads.">
39+
<parallel threadCount="2">
40+
<sequential>
41+
<antcall target="pdepend" />
42+
<antcall target="phpmd" />
43+
</sequential>
44+
<antcall target="phpcpd" />
45+
<antcall target="phpcs" />
46+
<antcall target="phploc" />
47+
</parallel>
48+
</target>
49+
50+
<target name="pdepend" description="Generate jdepend.xml and software metrics charts using PHP_Depend">
51+
<exec executable="pdepend${script-suffix}">
52+
<arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
53+
<arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
54+
<arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
55+
<arg path="${source}" />
56+
</exec>
57+
</target>
58+
59+
<target name="phpmd" description="Generate pmd.xml using PHPMD">
60+
<exec executable="phpmd${script-suffix}">
61+
<arg path="${joomlasource}" />
62+
<arg value="xml" />
63+
<arg value="${basedir}/build/phpmd.xml" />
64+
<arg value="--reportfile" />
65+
<arg value="${basedir}/build/logs/pmd.xml" />
66+
</exec>
67+
</target>
68+
69+
<target name="phpcs" description="Generate checkstyle.xml using PHP_CodeSniffer">
70+
<exec executable="phpcs${script-suffix}">
71+
<arg value="--report=checkstyle" />
72+
<arg value="--extensions=php" />
73+
<arg value="-p" />
74+
<arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
75+
<arg value="--standard=${basedir}/build/phpcs/Joomla" />
76+
<!--
77+
<arg value="- -ignore=${basedir}/build,${basedir}/etc,${basedir}/language,${basedir}/platformApp,${basedir}/vendor,${basedir}/www,${basedir}/*tmpl/*" />
78+
-->
79+
<arg value="--ignore=${basedir}/*tmpl/*" />
80+
<arg path="${source}" />
81+
<arg path="${cli}" />
82+
</exec>
83+
</target>
84+
85+
<target name="lint" description="Perform syntax check of sourcecode files">
86+
<apply executable="php" failonerror="true">
87+
<arg value="-l" />
88+
89+
<fileset dir="src">
90+
<include name="**/*.php" />
91+
<modified />
92+
</fileset>
93+
<fileset dir="cli">
94+
<include name="**/*.php" />
95+
<modified />
96+
</fileset>
97+
</apply>
98+
</target>
99+
100+
<target name="composervalidate" description="Perform validation of composer.json files.">
101+
<exec executable="composer" failonerror="true">
102+
<arg value="validate" />
103+
</exec>
104+
105+
<apply executable="composer" failonerror="true">
106+
<arg value="validate" />
107+
108+
<fileset dir="${source}">
109+
<include name="**/composer.json" />
110+
<modified />
111+
</fileset>
112+
</apply>
113+
</target>
114+
115+
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml">
116+
<exec executable="phpunit${script-suffix}">
117+
<arg value="-c${basedir}/phpunit-jenkins.xml" />
118+
</exec>
119+
</target>
120+
121+
<target name="phpcpd" description="Generate pmd-cpd.xml using PHPCPD">
122+
<exec executable="phpcpd${script-suffix}">
123+
<arg value="--log-pmd" />
124+
<arg value="${basedir}/build/logs/pmd-cpd.xml" />
125+
<arg path="${source}" />
126+
</exec>
127+
</target>
128+
129+
<target name="phploc" description="Generate phploc.csv">
130+
<exec executable="phploc${script-suffix}">
131+
<arg value="--log-csv" />
132+
<arg value="${basedir}/build/logs/phploc.csv" />
133+
<arg path="${source}" />
134+
</exec>
135+
</target>
136+
137+
138+
139+
<target name="build" depends="clean,phpunit,composervalidate,installdep,parallelTasks" />
140+
</project>

phpunit-jenkins.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="tests/bootstrap.php" colors="false">
3+
<!-- These constants help setup environment configurations for running optional tests.
4+
<php>
5+
<const name="JTEST_DATABASE_MYSQL_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
6+
<const name="JTEST_DATABASE_MYSQLI_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
7+
<const name="JTEST_DATABASE_POSTGRESQL_DSN" value="host=localhost;port=5432;dbname=joomla_ut;user=utuser;pass=ut1234" />
8+
<const name="JTEST_DATABASE_ORACLE_DSN" value="host=localhost;port=1521;dbname=joomla_ut;user=utuser;pass=ut1234" />
9+
<const name="JTEST_DATABASE_SQLSRV_DSN" value="host=localhost;dbname=joomla_ut;user=utuser;pass=ut1234" />
10+
<const name="JTEST_HTTP_STUB" value="http://localhost/joomla-platform/tests/suites/unit/stubs/jhttp_stub.php" />
11+
</php>
12+
-->
13+
14+
<testsuites>
15+
<testsuite name="Unit">
16+
<directory>tests/tracker</directory>
17+
</testsuite>
18+
</testsuites>
19+
20+
<logging>
21+
<log type="coverage-html" target="build/coverage" title="Joomla-Framework" charset="UTF-8" yui="true" highlight="true"
22+
lowUpperBound="35" highLowerBound="70" />
23+
<log type="coverage-clover" target="build/logs/clover.xml" />
24+
<log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" />
25+
</logging>
26+
<filter>
27+
<!--
28+
<whitelist addUncoveredFilesFromWhitelist="true">
29+
<directory suffix=".php">src/Joomla</directory>
30+
<exclude>
31+
<directory suffix=".php">src/Joomla/*/Tests</directory>
32+
<directory suffix=".php">src/Joomla/*/tests</directory>
33+
</exclude>
34+
</whitelist>
35+
-->
36+
</filter>
37+
</phpunit>

0 commit comments

Comments
 (0)