Speeding up iOS builds on CircleCI

Circle CI is a great tool for building iOS projects. It is not primarily mobile focused, but since the service is pretty young, developers try to optimise as much of routine tasks every project has to deal with when it comes to Continuous Integration.

One of interesting features Circle has out of the box is caching of dependencies. Caching of CocoaPods works out of the box, Carthage caching is not directly supported, but very easy to set up.

I was recently tinkering with circle setup and noticed that even though actual pods were cached, the service was cloning master repo for every build:

## Install CocoaPods
cd "."  
export LC_CTYPE="en_US.UTF-8"  
pod check || bundle exec pod install

Setting up CocoaPods master repo

CocoaPods 1.0.1 is available.  
To update use: `gem install cocoapods`  
Until we reach version 1.0 the features of CocoaPods can and will change.  
We strongly recommend that you use the latest version at all times.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.0.1

Setup completed  

This step took around ~3 minutes for my project.

I was able to reduce this time to 15 seconds by adding pods spec repo to circle's cache:

## cat circle.yml

    - "/Users/distiller/.cocoapods/"
    - make test

I haven't found any drawbacks of this solution yet, so I'm going to keep the setup and see if it is really worth it.