Intro

Codecov is a new(?) Code Coverage web app supporting more languages than you can shake a stick at and apparently at a shockingly low price of $5/month for unlimited private repos. I was sold immediately.

Wercker

Currently I'm using Werkcer for CI; it's in beta at the moment (and has been for aaaages). It has a few hiccups, but it's nice and simple and - hey look - free for private repos (while in beta). No word on pricing yet.

Wercker + codecov

It's dead simple, but just in case you're brain dead...

Prep for all languages

  1. In codecov, add your repo
  2. Copy the token codecov gives you
  3. Head to the settings page in a particular Wercker build.
  4. Get to the 'Pipeline' section
  5. Add a new environment variable, call it CODECOV_TOKEN (name will be important for Ruby)
  6. Paste in the token from codecov
  7. important check the 'Protected' checkbox so the token never appears in your Wercker logs
  8. Save it

Python

I'm using tox on Python 2.7; my wercker.yml looks like this:

box: python:2.7-onbuild
build:
  steps:
    - script:
        name: Install required libs
        code: |
            pip install tox
            pip install codecov
    - script:
        name: Run Tox
        code: |
            tox
    - script: 
        name: Upload codecov results
        code: codecov --token=$CODECOV_TOKEN

Ruby

Ruby requires some changes to the code but doesn't need us to touch the werkcer.yml file so, straight from the codecov documentation, do the following:

  1. Add gem 'codecov', :require => false, :group => :test to your Gemfile
  2. Add the following to your test helper file (I'm using rspec, so into spec/spec_helper.rb)

    require 'simplecov'
    SimpleCov.start
    if ENV['CI']=='true'
      require 'codecov'
      SimpleCov.formatter = SimpleCov::Formatter::Codecov
    end