About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:testing:continuous_integration

This is an old revision of the document!


Continuous Integration

VuFind uses continuous integration to monitor the quality of the code base and allow early detection of problems. This is a work in progress, and this page exists to help keep track of tools and ideas. You can help by writing new unit_tests and by fixing problems identified within our Jenkins instance.

Technologies in Use

The following technologies are currently installed as part of our continuous integration setup.

Jenkins (formerly Hudson)

Jenkins (formerly named Hudson) is a popular open source continuous integration server.

Resources:

Travis CI

Travis CI is a hosted continuous integration service with strong GitHub integration. While VuFind uses Jenkins for its primary CI functionality due to richer reporting capabilities, it also uses Travis as a first line of defense for detecting test breaks and style problems in pull requests.

Phing

Phing is a build tool designed as the PHP-based answer to Apache Ant. It can be integrated with Hudson just as Maven can. We currently use Phing to set up our Selenium test environment and to generate several of Hudson's reports.

Resources:

PHPUnit

PHPUnit is a unit testing framework for PHP. See the unit_tests page for more details.

Mink / Zombie.js

We use Mink (a browser automation abstraction library) with Zombie.js (a Node.js-based headless browser) for building automated browser-based tests. This is useful for integration testing, although complex tests can sometimes take a very long time to execute.

Resources:

Setting up Jenkins

Here are quick notes on how to set up Jenkins with VuFind. These notes were made when setting up the environment on a CentOS 6.5 server with Jetty 9, so they may need to be adjusted for other distributions and versions.

Install Jenkins

Install Jenkins using commands suitable for the distribution, e.g.

  sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
  yum install jenkins

Install Jetty

Install Jetty along the lines of http://techtraits.com/jetty9install/ but get the latest version and add the following to the beginning of /etc/init.d/jetty:

  JETTY_HOME=/opt/jetty
  JETTY_USER=jetty
  JETTY_ARGS="jetty.port=8081 jetty.host=127.0.0.1"
  JETTY_LOGS=/var/log/jetty/

Create log directory:

  mkdir /var/log/jetty
  chown jetty /var/log/jetty

Configure Jetty

Link Jenkins to Jetty's webapps:

  ln -s /usr/lib/jenkins/jenkins.war /opt/jetty/webapps/
  

Add to /opt/jetty/etc/jetty.xml (change the path as necessary):

  <Call class="java.lang.System" name="setProperty">
    <Arg>JENKINS_HOME</Arg>
    <Arg>/data/jenkins</Arg>
  </Call>

Add security context /opt/jetty/webapps/jenkins.xml to jetty:

  <Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/jenkins</Set>
    <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/jenkins.war</Set>
    <Get name="securityHandler">
      <Set name="loginService">
        <New class="org.eclipse.jetty.security.HashLoginService">
          <Set name="name">Jenkins Realm</Set>
          <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
        </New>
      </Set>
    </Get>
  </Configure>

Setup directory permissions (change the path as necessary):

  
  chown jetty:adm /data/jenkins

Set up reverse proxy e.g. from Apache if necessary (see https://wiki.jenkins-ci.org/display/JENKINS/Running+Jenkins+behind+Apache)

Install Testing Tools

Install ImageMagick development package (e.g. ImageMagick-devel).

Install phpunit and phpcpd

  pear channel-discover pear.phpunit.de
  pear install --alldeps phpunit/PHPUnit

Install phpcpd

  pear channel-discover pear.symfony.com
  pear channel-discover pear.netpirates.net
  pear install phpunit/phpcpd

Install phpdoc

  pear channel-discover pear.phpdoc.org
  pear install phpdoc/phpDocumentor

Install phpmd

  pear channel-discover pear.pdepend.org
  pear channel-discover pear.phpmd.org
  pear install phpmd/PHP_PMD

Install phpcs

  pear install PHP_CodeSniffer

Install phploc

  pear install phpunit/phploc

Install GraphViz (optional)

  • Get a recent version. E.g. the version in CentOS 6 (2.26) doesn't always work properly. Or leave it out altogether.

Configure Jenkins

Start Jetty, point your browser to http://host:port/jenkins and configure Jenkins security etc. (not documented here).

Install the following plugins to Jenkins:

  • GitHub
  • Phing
  • Checkstyle
  • PMD
  • DRY
  • Clover
  • JDepend
  • Test Results Analyzer

Set up a Project in Jenkins

These are sample values, modify accordingly:

  • Project name: VuFind
  • Source Code Management/Git:
  • Build triggers:
  • Build / Invoke Phing targets:
    • Targets: main
    • If you need to customize the build file, click Advanced… and enter your custom build file name in “Phing Build File”
  • In Post-build Actions, add all the publishers:
    • Checkstyle (Checkstyle results: /tmp/build/vufind/reports/checkstyle.xml)
    • PMD (PMD results: /tmp/build/vufind/reports/phpmd.xml)
      • duplicate code (/tmp/build/vufind/reports/pmd-cpd.xml)
      • Clover coverage (/tmp/build/vufind/reports/coverage)
      • Junit (/tmp/build/vufind/reports/phpunit.xml)
      • Javadoc (/tmp/build/vufind/apidocs)
      • JDepend (/tmp/build/vufind/reports/jdepend.xml)
development/testing/continuous_integration.1449777047.txt.gz · Last modified: 2015/12/10 19:50 by demiankatz