Continuous Integration - A Step by Step Guide

In the software development world, Continuous Integration (CI) is the process of continuously applying quality control to a piece of software in development. What this usually amounts to in practice is having automated systems that build, deploy and test your software each time a change is made. As software complexity increases, and more developers are added to the team, having these types of automated systems in place becomes essential to controlling the quality and cost of projects.

At Atchai, we have been using many of the components of CI (version control, automated build systems, testing frameworks) for years but only recently have we needed to put them all together into a single, coherent system.

Our Setup

Architecture

The system we’ve settled upon revolves around a few crucial pieces of software. Meet the team:

Jenkins

The boss - Responsible for polling Git for changes, software builds and deployment, initiating the tests and providing reports.

Fabric

The glue - Executes build and deployment scripts remotely

Selenium

The perfectionist - Runs high-level, “black box” functional tests against the site such as logging in or submitting content

Siege

The sledgehammer - Tests site performance by initiating a large number of requests

The Stack

To give you some context, here’s the software stack/tools we generally use for our projects (although alternatives to these should work just as well):

A Commit (A Day In The Life)

Untitled-2.jpg

To give you an idea of how our system works day-to-day I’ll walk you through what happens with a single commit:

Installation Instructions

Had enough of the theory? Let’s go…

Install Jenkins

Install Selenium

Install Siege

What’s Next?

Untitled-23.jpg

Everything is now ready for your CI system except for the Fabric scripts to actually build the project. The Fabric script for each project will necessarily be different but if you’d like to see an example, especially if you use Drupal, have a look at our CI project on github which has helper class for installing Drupal using Drush and an example usage of it.

Once you have your system running I recommend looking through the Jenkins plugins for anything that might be useful to your setup. The power (and complexity) of Jenkins comes through its plugins so it’s worth getting acquainted.