Continuous Integration: Tools of the Trade
Part II of Promet Source’s series of blogs regarding Continuous Integration continues with a summary of the tools of the trade to implement Continuous Integration. Part I was an overview of the 10 Principles of Continuous Integration, ranked in order of importance.
Now, we provide suggestions for tools that developers can use to help you accomplish the 10 principles outlined in our previous blog. It's very possible that you are already using some of these tools or various software that are similar to them. You might benefit from some of the alternative software and understand the types of tools available. The following list reviews my recommended tools to accomplish CI for ultimate efficiency.
Git is probably the most popular version control system among Linux based developers today. It has several features that supersedes its competitors. It is also known as a distributed version control system which means that even when you aren't connected to the network, you can still make commits as needed. Pushing and pulling changes from other Git repositories creates an intricate web of repositories, but once the slightly higher learning curve on the workflow is achieved, it makes for a very powerful and efficient version control system.
The workflow used with Git is also known as git-flow. This is the process of moving changes between several branches of development from one version of a product to another. It is best described with a picture:
Courtesy of Joefleming.net
In this case, Master is your pristine releasable copy of your product. Using this flow along with a common code review greatly increases your code's quality.
When picking your version control system, I'd recommend considering the type of projects you are working on. At Promet we live in the world of open source software and Drupal in particular. Git is used for Drupal core and contributed module development and therefore has become the standard for professional development with Drupal. Git is also used for many other popular projects including Android, jQuery, Linux kernel, and Ruby on Rails.
Other version control systems are:
Vagrant is a way for developers to take an environment and distribute it among other developers. It allows an entire virtual machine to be distributed, including the setup, from software to resources (memory, hard drive space, video memory, etc).
This comes at the cost of having your developers set up a machine that is buildable, but the hours that developers spend setting up local environments (that they can utterly destroy and then rebuild) is reduced greatly.
Building an entire machine after the initial configuration stage (which is version controllable) is literally one command. Vagrant is suitable for sites that will be shared among several team members.
Chef is a configuration management tool that works with Vagrant to configure a machine. At a basic level, it’s a series of scripts that handles building and maintaining the software and configuration layer of a server. For instance, if you need version 5.4 of PHP, you can write this in a single line in a configuration file and all the servers that are set up to receive that instruction will download and install PHP 5.4 (if they are able).
Having a version-controlled and distributed system for both your application and server infrastructure in the code will increase accountability and efficiency. Using a configuration management tool like Chef will also add a layer of automation that will free your system administrator to concentrate on other tasks and not burn time manually building server and application infrastructure.
Other configuration management tools include:
PHPUnit is a unit testing framework. It is technically used for more than just unit testing, however. PHPUnit is also used to run automated testing for interface testing such as Selenium, PhantomJS, and Behavioral Driven Development platforms such as Behat. Note: There are no PHP specific answers to the following technologies including PHPUnit. However, performing continuous integration in a PHP/Drupal shop almost always requires these.
Other testing frameworks include:
Ruby's Test::Unit library
The “meat and potatoes” that make Continuous Integration possible is Jenkins. Jenkins is server software that provides users the ability to perform tasks on hooks and on a job basis.
In essence, at the click of a button, on code commit or at a specific time, you can have an entire machine set up with the right settings, your product's code pushed to that machine, tested, and the results sitting available for you.
This software is rightfully labeled "an extendable open source continuous integration server." You could accomplish all of this with a variety of scripts, however, using a market standard software like Jenkins makes life easier when things go wrong. The variety of plugins alone should be enough to sway even the newest of users.
Other alternatives are:
If you recall from our first post in this series about CI, we emphasized that CI is not just about a set of tools but that it is about a set of development practices. The tools are there to help you implement and reinforce those good practices. Your CI tools should enable your entire release process from building, to testing, to deploying.
For developers looking to get started with CI for your business, you can take our list of recommended tools and kick the tires. Remember, these CI processes and tools are there to help you get feedback as early on as possible in your development project. The earlier and faster you catch problems, the easier and cheaper it is to fix them. And that kind of visibility is valuable to your business.
You can implement CI best practices immediately. Check out this DIY Continuous Integration video!
Want to learn more about Drupal development?