The Full Stack Python Guide to Deployments book has been released!

Fork me on GitHub

Continuous Integration

Continuous integration (CI) automates building, testing and deploying applications.

Why is continuous integration important?

When CI is set up well it can dramatically reduce deployment times by eliminating manual steps and ensure code does not have bugs that are being checked by automated tests. Source code changes as a project evolves. CI combined with unit and integration tests check that code modifications do not break existing tests ensure the software works as intended.

Continuous integration example

The following picture represents a high level perspective on how continuous integration and deployment can work.

One potential way for continuous integration to work.

In the above diagram, when new code is committed to a source repository there is a hook that notifies the continuous integration server that new code needs to be built (the continuous integration server could also poll the source code repository if a notification is not possible).

The continuous integration server pulls the code to build and test it. If all tests pass, the continuous integration server begins the deployment process. The new code is pulled down to the server where the deployment is taking place. Finally the deployment process is completed via restarting services and related deployment activities.

There are many other ways a continuous integration server and its deployments can be structured. The above was just one example of a relatively simple set up.

Open source CI projects

Hosted CI services

  • Travis CI provides free CI for open source projects and has a commercial version for private repositories.

  • Bamboo is Atlassian's hosted continuous integration that is also free for open source projects.

  • Circle CI works with open or closed source projects on GitHub and can deploy them to Heroku if builds are successful.

  • Shippable uses Docker containers to speed the build and integration process. It's free for public repositories.

  • Drone is another CI service that also provides free builds for open source projects.

  • Codeship provides continuous integration for Python 2.7.

  • Snap is a CI server and build pipeline tool for both integrating and deploying code.

Continuous integration resources

What do you want to work on next for your deployment?

How do I log errors that occur in my application?

What can I do to mitigate security vulnerability in my web app?

What is Docker and how does it fit with Python deployments?

Sign up here to receive an email with major updates to this site and Python tutorials delivered to your inbox once a month.