CircleCI or:

How I learned to stop worrying
and love CI again

I am...

I vs Continuous Integration

The experience. Personal, not scientific

Buildbot

  • First CI experience: ~2009
  • Pretty hard from developer perspective
  • Have no idea on how to configure BuildBot yet
  • But it's written on Python

Buildbot

Buildbot Mail

Buildbot

It's Something

Hudson / Jenkins

  • I understood what CI is in 2011
  • Hudson, then Jenkins helped me run tests, deploy projects
  • I wrote code, asked DevOps to integrate project to Jenkins
  • I wrote Fabric commands, asked DevOps to integrate them in Jenkins
  • What if something didn't work? Yeah, ask DevOps to fix

Hudson / Jenkins

Jenkins Mail

Hudson / Jenkins

Okay

Travis CI

  • Open Source projects require CI as well
  • Travis CI was first CI easy to configure & use
  • I wrote code & did changes to .travis.yml
  • If something didn't work, I take care of problem, cause I know how
  • A lot of open source projects run on Travis
  • Infrastructure just didn't handle load well
  • They fixed eventually, but I don't trust Travis anymore

Travis CI

Travis CI Email

Travis CI

Hipster Barista: Travis CI is my CI

What else?

  • Drone.io – Written on Go, what else?
  • TeamCity – CI by JetBrains. Mkay
  • Bamboo – CI by Atlassian. They have JIRA, but that's it
  • Shining Panda – Jenkins in cloud

What else?

Fuck that shit

Jenkins

The big. The monolythic. The standart

Pre-Step 1. Setup Jenkins server

  • Start an instance
  • Setup Python there
  • Install Jenkins from JAR
  • Configure it somehow

Step 1. Add repo as new job

Jenkins. Add Job

Step 1. Add repo as new job

  • Then you need to specify how to run your tests in UI
  • You will be able to setup post-job in UI as well

Step 2. Repeat

Jenkins. Add Job from existed Job

Features

  • Completely Everything
  • Everything, you can imagine for CI
  • But you will have a very bad time, configuring Jenkins

Configuration

Jenkins Configuration

User Interface & User Experience

Mkay

Developer Experience

Mkay

CircleCI

The fresh. The neat. The startup

Introduction

CircleCI. First Mention

First Look

  • Quick Setup
    Signup. Add a Project to CircleCI. Start building and testing right away. It's that simple!
  • Build
  • Test
  • Deploy

Step 1. circle.yml

Configure Container (machine)

machine:
  environment:
    DATABASE_URL: ...
    DJANGO_SETTINGS_MODULE: ...
    ...: ...
  python:
    version: ...
  services:
    - postgresql
  timezone: Europe/Kiev

Step 1. circle.yml

Build Dependencies

dependencies:
  cache_directories:
    - ...
  override:
    - pip install -U pip wheel
    - make

Step 1. circle.yml

Run Tests

test:
  override:
    - TEST_ARGS=--with-xunit make test

  post:
    - "coveralls || :"
    - ...

Step 1. circle.yml

Deploy Project

deployment:
  staging:
    branch: develop
    commands:
      - LEVEL=staging make deploy

  production:
    branch: master
    commands:
      - LEVEL=production make dump-db
      - LEVEL=production make deploy

Step 2. Build Project

CircleCI. Build Project

Step 3. Repeat

  • You need ~5-10 min to add new project to CircleCI
  1. Copy circle.yml to repo
  2. Edit necessary lines
  3. Commit & push to GitHub
  4. Press Build Project button on CircleCI

Screenshots

Dashboard

CircleCI. Dashboard

Organization Dashboard

CircleCI. Dashboard

Build Results

CircleCI. Dashboard

Build Results

CircleCI. Dashboard

Errors

CircleCI. Dashboard

Errors (Email)

CircleCI. Errors (Email)

Graphs (Insights)

CircleCI. Dashboard
Yeah!

CircleCI & not Python

Frontend. Android. iOS

Build & Test & Deploy

machine:
  environment:
    COVERALLS_REPO_TOKEN: ...
    LEVEL: development
  node:
    version: 4.4.3
  timezone:
    America/Los_Angeles

dependencies:
  cache_directories:
    - node_modules
    - webpack/.babel-cache
  override:
    - npm install -g npm@3.8.6
    - make

Build & Test & Deploy

test:
  override:
    - make test
  post:
    - "npm run coveralls || :"
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - mv ./test-results.xml $CIRCLE_TEST_REPORTS/junit/test-results.xml

deployment:
  production:
    branch: master
    commands:
      - LEVEL=production make deploy

Build & Test & Deploy

  1. Push to GitHub
  2. Tests ran OK
  3. New build is deployed

Android APK Files

CircleCI. Android Artifacts

iOS Builds

CircleCI. iOS Build

Advanced Usage

CI. CD. More

Rebuild with SSH

CircleCI: Rebuild with SSH

Integrations

  • Chat Notifications
    • Slack
    • Hipchat
    • Flowdock/Campfire/IRC
  • Webhooks

Slack Integration

CircleCI: Slack Intergration

Publishing PyPI/NPM packages

  • Set PyPI/NPM credentials as env vars
  • Deploy new package on new tag pushed to GitHub
deployment:
    release:
      tag: /v\d+.\d+.\d+.*/
      commands:
        - ./circle-npm-login.sh
        - make deploy
  

Publishing PyPI/NPM packages

CircleCI: Publishing PyPI/NPM packages

Continuous Delivery

  • CircleCI has an API to run builds from command line
  • You able to configure deploying whole your stack with ease

Branch Deployment

CircleCI: Branch Deployment

Branch Deployment

CircleCI: Branch Deployment

Artifacts

general:
  artifacts:
    - "api_test_report.html"
    - "slow_tests.csv"

Services

  • Yes, you can use PostgreSQL, Redis and other services
machine:
  services:
    - mysql
    - postgresql
    - cassandra
    - elasticsearch
    - rabbitmq-server
    - redis
    - riak
    - beanstalkd
    - couchbase-server
    - neo4j
    - sphinxsearch

Problems

Paid Service

You need to pay for CircleCI

CircleCI: Pricing

Build Traffic

CircleCI: Build Traffic

Service Degradation

  • It requires GitHub to work
  • Sometimes GitHub does not work, as CircleCI

Service Degradation

GitHub Service Outage

I ♥ CircleCI

User Interface & User Experience

Me Gusta

Developer Experience

Me Gusta
True Story

Questions?