Karl Hughes

Karl Hughes

Continuous Integration on a Budget

Continuous Integration on a Budget

Since I wrote this in September, 2015, continuous integration has become pretty much the standard for smaller, more nimble companies, and it’s even making inroads at the enterprise level. The tools are so much better than they were 3 to 5 years ago, that there’s really no excuse not to automate your builds, tests, and deployments.

The tools I mention in this article haven’t changed too much since I wrote it, but I have written a bit more about this topic on Codeship’s blog, and will be putting out a new piece soon on CI with Docker. I am now using Webpack to build most of my frontend projects (instead of Grunt), and have stopped using Envoyer at the moment as it was more complex than what I needed.


A lot of people think that continuous integration is a luxury afforded only to companies with dedicated devops teams and massive budgets. That may have once been the case, but it is no longer true thanks to the many software tools and open source projects now available. In fact, I’d make the argument that small teams especially can’t afford not to invest in continuous integration. Once you make unit testing and automated deployments part of your normal project workflow, it’s hard to go back.

First, what is continuous integration?

Before I dig into the tools I use at work and on open source projects, let’s make sure we all understand the concept of continuous integration.

Strictly speaking, continuous integration is the process of merging all developers’ work into a main repository on a daily (or more frequent) basis.

More broadly, the term has come to imply that the code is also automatically tested, built, and deployed to a server when it is updated, so CI can be used as a way of describing your engineering team’s entire deployment process.

These concepts (continuous integration, automated testing, automated builds, and automated deployments) are all part of the same process of releasing and updating code, so for the remainder of the article, I’ll be talking about the processes we use to achieve all four goals under the umbrella of continuous integration. There is a spectrum of quality, customizability, and cost associated with each of the three CI paths I’ll outline below, and there are certainly tools that go way beyond what I’ll cover, but I hope this serves as a good introduction to anyone who’s been afraid of making CI a priority in their project - no matter how small.

The tools we use at Packback

At Packback we have a team of five engineers and we’ve raised some funding, so we can justify spending more on tools that help us manage deployments and continuous integration. Still, we keep things pretty lean and rely on a lot of open source or free solutions.

Codeception

Codeception is a PHP unit testing framework that offers behavior driven elements missing from using PHPUnit alone. It adds a layer of complexity, but there are benefits to its enhanced assertions.

Cost: Free

Grunt

Modern frontends are built, not statically hosted, so we use Grunt to concatenate and minify our script files as well as run our test-runner (see below).

Cost: Free

Karma/Jasmine

You certainly don’t have to use Jasmine with Karma, but we’ve found it the easiest combination of framework and runner for our Javascript testing.

Cost: Free

Laravel Forge

We use a PHP framework called Laravel for our backend APIs. The creator of Laravel has also been running a couple of complementary products that help developers deploy and manage their projects. Forge handles provisioning and deployment onto our servers.

Cost: $10 - $20/month

Envoyer

Forge is great for deploying to a single server, but Envoyer adds the ability to deploy to multiple servers with zero downtime. It’s another Laravel-specific tool, but you can use it for other PHP projects as well.

Cost: $10 - $50/month

Github

If you’re a web developer and you’re not familiar with Github get off my site and go read about it. There are certainly other options for hosting your repositories, but I’ve always been a Github fan.

Cost: Free - $200/month

Codeship

Codeship is the truly continuous integration part of this whole workflow. They give you a platform that will run your tests, deploy to one or multiple servers or services, and notify you if there was any problem along the way.

Cost: Free - $600/month

Digital Ocean

Digital Ocean offers one of the easiest and cheapest options for hosting. You can effortlessly scale servers and manage your DNS records there as well.

Cost: $5 - $80/month per server

Packback Continuous Integration Workflow

The tools I use on personal projects

I don’t want to spend $100/month just to host my personal website, so I’ve pared down my CI setup on personal projects. At this point I can get away with a low cost Heroku dyno as my only overhead.

PHPUnit

PHPUnit may be the no-frills option for PHP testing, but it’s also the most common and well documented.

Cost: Free

Gulp

Whether you use Grunt or Gulp comes down to preference. I like Gulp because it’s bundled in Laravel, and it’s my framework of choice.

Cost: Free

Github

Great for open source and closed source, Github starts with very cheap plans for individuals who just want a couple of private repos.

Cost: Free - $200/month

Codeship

Get up to 100 builds per month (enough for my personal projects) free.

Cost: Free - $600/month

Heroku

The only downside to Digital Ocean is that you occasionally have to SSH in and fuss with a setting or install a new service. You also have to deal with load balancing and scaling on your own. Hosting with Heroku means that you get all that built in, but you do pay a little more for a decent server.

Cost: Free - $500/month per server

Personal Project Continuous Integration Workflow

The tools I use for open source projects

Most open source projects rely on free tools unless there’s a bigger organization backing them. Fortunately, there’s a lot of good continuous integration tools out there for people who want to contribute to the open source community.

PHPUnit

As the most common PHP unit testing framework, it’s probably a good idea to use PHPUnit for open source projects. Don’t want to deter people from contributing just because they’re unfamiliar with your testing framework.

Cost: Free

Scrutinizer

Scrutinizer calls itself a “continuous inspection platform” which basically means that it inspects your code’s quality every time you push a change. This is really helpful when you have a variety of contributors with different skill levels contributing to a project and it gives you an idea of where code can be improved. It also integrates results from Travis (see below) to tell you if you’re build is failing or not.

Cost: Free for open source

Travis CI

Travis will run your tests and build your code on multiple server configurations so you can ensure that packages you release as open source will work in any environment.

Cost: Free for open source

Github

Once again, Github is the place to be for open source projects.

Cost: Free for open source

Open Source Continuous Integration Workflow

So that’s it. If you’ve got questions or you want to plug your own tools for CI, shoot me an email or a Tweet.

Read more like this in Archive