<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Jenkins_Integration_Testing_for_Plugin_Development</id>
	<title>Jenkins Integration Testing for Plugin Development - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/index.php?action=history&amp;feed=atom&amp;title=Jenkins_Integration_Testing_for_Plugin_Development"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;action=history"/>
	<updated>2026-04-19T11:55:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=64317&amp;oldid=prev</id>
		<title>Sarjona: This page will not be migrated to new devdocs</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=64317&amp;oldid=prev"/>
		<updated>2025-01-27T10:15:51Z</updated>

		<summary type="html">&lt;p&gt;This page will not be migrated to new devdocs&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:15, 27 January 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Template:WillNotMigrate}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;p&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This article describes how to use a Jenkins continuous integration server for automating PHPUnit and Behat tests for Moodle and Moodle plugins. The configuration uses Moodle&amp;#039;s way of running PHPUnit and Behat tests using the command line.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This article describes how to use a Jenkins continuous integration server for automating PHPUnit and Behat tests for Moodle and Moodle plugins. The configuration uses Moodle&amp;#039;s way of running PHPUnit and Behat tests using the command line.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sarjona</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=59489&amp;oldid=prev</id>
		<title>Mudrd8mz: Text replacement - &quot;&lt;/code&gt;&quot; to &quot;&lt;/syntaxhighlight&gt;&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=59489&amp;oldid=prev"/>
		<updated>2021-07-14T13:06:15Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;&amp;lt;/code&amp;gt;&amp;quot; to &amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&amp;quot;&lt;/p&gt;
&lt;a href=&quot;https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;amp;diff=59489&amp;amp;oldid=59276&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Mudrd8mz</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=59276&amp;oldid=prev</id>
		<title>Mudrd8mz: Text replacement - &quot;&lt;code&gt;&quot; to &quot;&lt;syntaxhighlight lang=&quot;php&quot;&gt;&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=59276&amp;oldid=prev"/>
		<updated>2021-07-14T13:03:22Z</updated>

		<summary type="html">&lt;p&gt;Text replacement - &amp;quot;&amp;lt;code&amp;gt;&amp;quot; to &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&amp;quot;&lt;/p&gt;
&lt;a href=&quot;https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;amp;diff=59276&amp;amp;oldid=47808&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Mudrd8mz</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=47808&amp;oldid=prev</id>
		<title>Jan.dagefoerde: Suddenly (as of M2.9), a Moodle dependency seems to require the intl extension as well.</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=47808&amp;oldid=prev"/>
		<updated>2015-05-06T12:41:18Z</updated>

		<summary type="html">&lt;p&gt;Suddenly (as of M2.9), a Moodle dependency seems to require the intl extension as well.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:41, 6 May 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l20&quot;&gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;sudo apt-get install postgresql&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;sudo apt-get install postgresql&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sudo apt-get install php5-cli php-pear php5-curl php5-pgsql php5-gd&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sudo apt-get install php5-cli php-pear php5-curl php5-pgsql php5-gd &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;php5-intl&lt;/ins&gt;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jan.dagefoerde</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=47756&amp;oldid=prev</id>
		<title>Jan.dagefoerde: Created page with &quot;&lt;p&gt; This article describes how to use a Jenkins continuous integration server for automating PHPUnit and Behat tests for Moodle and Moodle plugins. The configuration uses Mood...&quot;</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Jenkins_Integration_Testing_for_Plugin_Development&amp;diff=47756&amp;oldid=prev"/>
		<updated>2015-05-05T10:19:15Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;p&amp;gt; This article describes how to use a Jenkins continuous integration server for automating PHPUnit and Behat tests for Moodle and Moodle plugins. The configuration uses Mood...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;p&amp;gt;&lt;br /&gt;
This article describes how to use a Jenkins continuous integration server for automating PHPUnit and Behat tests for Moodle and Moodle plugins. The configuration uses Moodle&amp;#039;s way of running PHPUnit and Behat tests using the command line.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Integration scenario: We are developing a Moodle plugin. We want to run automated tests, ensuring that it runs correctly on multiple Moodle platform versions, e.g., Moodle 2.7 and Moodle 2.8. This is motivated by the fact that we announce compatibility with these versions in the Moodle plugin directory, and we want to - at least - know, when a plugin becomes incompatible with an older version or needs to be changed. Since we are only running one recent Moodle version for development, automated tests with other versions are useful for us.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Prerequisites for this manual: Ubuntu-based integration server, headless (i.e. without a graphical environment), here: Ubuntu 14.04. &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation of required software ==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install Jenkins as a Ubuntu native package, as described on their website (instructions currently at http://pkg.jenkins-ci.org/debian/).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install a Moodle runtime environment. A web server is not needed, since PHP 5&amp;#039;s standalone server will be used. The following commands were used for our system:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install postgresql&amp;lt;br /&amp;gt;&lt;br /&gt;
sudo apt-get install php5-cli php-pear php5-curl php5-pgsql php5-gd&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Install git, which will be used to obtain the sources of Moodle and of your plugin.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install git&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For acceptance tests, you need to use a browser. Therefore you need to be able to run graphical applications. On headless servers (i.e. those without a display), you can install Xvfb, emulating a display which will be used by your browser.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xvfb firefox&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Furthermore, acceptance tests require the Selenium standalone server to be installed. Download from http://www.seleniumhq.org/download/ (here: Version 2.45.0) and unpack it at a jenkins-accessible location, e.g. $JENKINS_HOME/selenium (here: /var/lib/jenkins/selenium).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Basic configuration of Jenkins using the shell ==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Configuration of the init script can be found at &amp;lt;code&amp;gt;/etc/default/jenkins&amp;lt;/code&amp;gt;. It is not strictly necessary to change anything here, but we set &amp;lt;code&amp;gt;HTTP_PORT=-1&amp;lt;/code&amp;gt; and added &amp;lt;code&amp;gt;HTTPS_PORT=8998&amp;lt;/code&amp;gt; to make the server only via HTTPS.  In that case, you also need to add &amp;lt;code&amp;gt;--httpsPort=$HTTPS_PORT&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;JENKINS_ARGS&amp;lt;/code&amp;gt; variable and restart Jenkins.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Furthermore, Moodle requires a &amp;lt;code&amp;gt;config.php&amp;lt;/code&amp;gt; which is not contained in a repository. Therefore, configuration files need to be stored at a separate location, from where they can be pulled in. For our scenario, we stored the configuration file at &amp;lt;code&amp;gt;$JENKINS_HOME/moodle-config/config_$target.php&amp;lt;/code&amp;gt;, where $target indicates a Moodle branch to build against (e.g., /var/lib/jenkins/moodle-config/config_MOODLE_28_STABLE.php).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Jenkins server configuration ==&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
For all following steps you need to open Jenkins in your browser.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Install or update the following plugins:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Xvfb plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Multiple SCMs plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Matrix project plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;JUnit plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;GitHub plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Job Configuration History Plugin (optional, but very useful)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Configure Jenkins in the following way (Manage Jenkins → Configure System):&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Git&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add a git installation. Choose an arbitrary name and set the path to &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Git plugin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Set the fields &amp;lt;code&amp;gt;Global Config user.name Value&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Global Config user.email Value&amp;lt;/code&amp;gt;. In our case, we set those values to account and e-mail of a technical GitHub account that is only used by the Jenkins server&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
Create a job for your integration scenario:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;On the dashboard, select New Item. &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Choose Multi-configuration project and define an Item name without any spaces.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;On the next page, define the following settings (Change to your requirements. Remember our integration scenario described above!):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;GitHub project: URL to the web page of your repository&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Source Code management:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Choose &amp;lt;code&amp;gt;Multiple SCMs&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;lt;code&amp;gt;Add SCM&amp;lt;/code&amp;gt; to add two git repositories.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For the first repository,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set the URL to &amp;lt;code&amp;gt;git://git.moodle.org/moodle.git&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Since this is a public repository, credentials are not required.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Under Additional Behaviours, add &amp;lt;code&amp;gt;Advanced clone behaviours&amp;lt;/code&amp;gt; and check the option &amp;lt;code&amp;gt;Shallow clone&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For the second repository,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set the URL to the URL of your git repository.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If this is a private repository, add credentials for accessing it (consider SSH authentication!)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Under Additional Behaviours, add &amp;lt;code&amp;gt;Check out to a sub-directory&amp;lt;/code&amp;gt; and, for &amp;lt;code&amp;gt;Local subdirectory for repo&amp;lt;/code&amp;gt;, enter the path where you would deploy your module in a usual Moodle installation (e.g., &amp;lt;code&amp;gt;mod/yourmodule&amp;lt;/code&amp;gt;), without surrounding slashes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Under Additional Behaviours, add &amp;lt;code&amp;gt;Advanced clone behaviours&amp;lt;/code&amp;gt; and check the option &amp;lt;code&amp;gt;Shallow clone&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Build Triggers:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check Build when a change is pushed to GitHub.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check Poll SCM. As a schedule, define e.g. &amp;lt;code&amp;gt;H/5 * * * *&amp;lt;/code&amp;gt; for polling every five minutes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Configuration Matrix:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add two user-defined axes.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For the first axis, set name to &amp;lt;code&amp;gt;target&amp;lt;/code&amp;gt; and values to &amp;lt;code&amp;gt;MOODLE_28_STABLE MOODLE_27_STABLE&amp;lt;/code&amp;gt;. These values correspond to the branch names used in the Moodle repository.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For the second axis, set name to &amp;lt;code&amp;gt;testtype&amp;lt;/code&amp;gt; and values to &amp;lt;code&amp;gt;UnitTest BehatTest&amp;lt;/code&amp;gt;. These are used later on to perform different test types - be patient :).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check Run each configuration sequentially.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Build Environment:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Check Start Xvfb before the build, and shut it down after.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Build:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add Execute shell&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following commands (Note that we use &amp;lt;code&amp;gt;$target&amp;lt;/code&amp;gt; here, which always holds the current value of &amp;lt;code&amp;gt;target&amp;lt;/code&amp;gt; in a particular configuration. Furthermore, this copies an appropriate config.php file into the current workspace):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 120pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;git checkout $target;&amp;lt;br /&amp;gt;&lt;br /&gt;
curl -s https://getcomposer.org/installer | php;&amp;lt;br /&amp;gt;&lt;br /&gt;
php composer.phar install --prefer-source;&amp;lt;br /&amp;gt;&lt;br /&gt;
cp $JENKINS_HOME/moodle-config/config_$target.php config.php;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;#039;padding-left: 60pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add Conditional step (single)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run?: &amp;lt;code&amp;gt;Strings match&amp;lt;/code&amp;gt;, String 1: &amp;lt;code&amp;gt;${testtype}&amp;lt;/code&amp;gt;, String 2: &amp;lt;code&amp;gt;UnitTest&amp;lt;/code&amp;gt; (the motivation is that this command is only run for unit tests. In contrast, the other step will be for behat acceptance tests).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Builder: &amp;lt;code&amp;gt;Execute shell&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following commands:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 120pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ../moodledata/phpunit;&amp;lt;br /&amp;gt;&lt;br /&gt;
php admin/tool/phpunit/cli/init.php;&amp;lt;br /&amp;gt;&lt;br /&gt;
vendor/bin/phpunit --log-junit results/phpunit/phpunit.xml --group mod_ratingallocate || true;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;#039;padding-left: 60pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add Conditional step (single)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Run?: &amp;lt;code&amp;gt;Strings match&amp;lt;/code&amp;gt;, String 1: &amp;lt;code&amp;gt;${testtype}&amp;lt;/code&amp;gt;, String 2: &amp;lt;code&amp;gt;BehatTest&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Builder: &amp;lt;code&amp;gt;Execute shell&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Enter the following commands (replace &amp;lt;code&amp;gt;[SeleniumVersion]&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;[ModuleTag]&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;[JobName]&amp;lt;/code&amp;gt; accordingly):&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;#039;padding-left: 120pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;mkdir -p ../moodledata/behat;&amp;lt;br /&amp;gt;&lt;br /&gt;
php admin/tool/behat/cli/init.php;&amp;lt;br /&amp;gt;&lt;br /&gt;
java -jar /var/lib/jenkins/selenium/selenium-server-standalone-[SeleniumVersion].jar &amp;amp;gt; /dev/null 2&amp;amp;gt;&amp;amp;amp;1 &amp;amp;amp;&amp;lt;br /&amp;gt;&lt;br /&gt;
SELENIUM_PID=$!&amp;lt;br /&amp;gt;&lt;br /&gt;
php -S localhost:8000 &amp;amp;gt; /dev/null 2&amp;amp;gt;&amp;amp;amp;1 &amp;amp;amp;&amp;lt;br /&amp;gt;&lt;br /&gt;
PHP_PID=$!&amp;lt;br /&amp;gt;&lt;br /&gt;
vendor/bin/behat --config /var/lib/jenkins/jobs/[JobName]/workspace/target/moodledata/behat/behat/behat.yml --tags &amp;#039;@[ModuleTag]&amp;#039; --format moodle_progress,junit --out ,behatlog || true;&amp;lt;br /&amp;gt;&lt;br /&gt;
kill $SELENIUM_PID&amp;lt;br /&amp;gt;&lt;br /&gt;
kill $PHP_PID&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;ul style=&amp;#039;padding-left: 30pt&amp;#039;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Post-build Actions:&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Add Publish JUnit test result report&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Change the pattern for &amp;lt;code&amp;gt;Test report XMLs&amp;lt;/code&amp;gt; to the value &amp;lt;code&amp;gt;**/phpunit/phpunit.xml,**/behatlog/*.xml&amp;lt;/code&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Save the configuration and start the first build to test it.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer tools]]&lt;/div&gt;</summary>
		<author><name>Jan.dagefoerde</name></author>
	</entry>
</feed>