Continuous Integration


Steve Desmond


Ithaca Web People

August 2, 2016

No One Agrees How to Define CI or CD

https://blog.snap-ci.com/blog/2016/07/26/continuous-delivery-integration-devops-research/

"It appears that the use of a CI server or tool is fairly synonymous with doing CI."

x

What is Continuous Integration?

A Set of Practices

http://martinfowler.com/articles/continuousIntegration.html
  • Everyone Commits To the Mainline Every Day
  • Every Commit Should Build the Mainline on an Integration Machine
  • Maintain a Single Source Repository
  • Automate the Build
  • Make Your Build Self-Testing
  • Fix Broken Builds Immediately
  • Keep the Build Fast
  • Test in a Clone of the Production Environment
  • Make it Easy for Anyone to Get the Latest Executable
  • Everyone can see what's happening
  • Automate Deployment

Why?

Why Do CI?

  • Quality
  • Stability
  • Visibility

 

Always-releasable software

How?

Automate the Build

(and Make Your Build Self-Testing)

  1. Checkout Code
  2. Build Application
  3. Run Tests
						
#!/bin/bash
git clone git@github.com:user/repo
npm install
npm test
						
					
						
#!/bin/bash
git clone git@github.com:user/repo
composer install
phpunit
						
					

Every Commit
Should Build the Mainline
on an Integration Machine

  • cron job
  • server daemon
  • post-commit hooks

Continuous Integration Tools

Appveyor Codeship CruiseControl GitLab
Go Hudson
Jenkins Snap TeamCity
Travis Visual Studio Team Services
https://en.wikipedia.org/wiki/Comparison_of_continuous_integration_software

CI Tools Cover:

  • Automate the Build
  • Make Your Build Self-Testing
  • Every Commit Should Build the Mainline on an Integration Machine
  • Make it Easy for Anyone to Get the Latest Executable
  • Everyone can see what's happening

Travis CI

Travis CI Logo

SaaS web app

GitHub integration

convention over configuration

demo time

What about the others?

  • Everyone Commits To the Mainline Every Day
  • Fix Broken Builds Immediately
  • Keep the Build Fast

The Bigger Picture

  • Continuous Integration
    1. Checkout Code
    2. Build Application
    3. Run Unit Tests
    4. Deploy to Test Env
    5. Run Acceptance Tests





  • Continuous Delivery
    1. Deploy to Staging
    2. Moar Tests!
    3. Push-Button to Prod


  • Continuous Deployment
    1. Automatic to Prod
      (YOLO)
Continuous delivery example https://en.wikipedia.org/wiki/Continuous_delivery

Who does CD?

DHH tweet

Etsy: ~50x/day

Facebook: ~200x/day

Amazon: ~1000x/day

Resources

This presentation
https://github.com/stevedesmond-ca/presentations/tree/iwp-ci

Example project
https://github.com/stevedesmond-ca/travis-example-node

Travis CI
https://travis-ci.org

Steve Desmond