LoginSignup
25
20

More than 5 years have passed since last update.

Carthageのcacheを実現して、CircleCIを10分早くする!

Last updated at Posted at 2016-03-31

Why

iOSのビルド&テストにCircleCIを使用していますが、毎回carthage bootstrapをしていると、それだけでも10分くらい食います。CIが遅いと不便なので、このボトルネックを解消しようと思いました。

実装方法

Carthageを更新するべき時だけ更新する

Cartfile.resolvedに変更があった場合だけ、carthage bootstrapを走らせます。

script/install
#!/bin/bash

bundle install --path=vendor/bundle

if ! diff Cartfile.resolved Carthage/Cartfile.resolved &>/dev/null; then
  carthage bootstrap
  cp Cartfile.resolved Carthage
fi

Cartfile.resolvedに変更があったかどうかを知るために、git管理外でCarthage/Cartfile.resolvedを保持しておきます。

.gitignore
# Carthage
Carthage/Checkouts
Carthage/Build
Carthage/Cartfile.resolved

CircleCIの設定

用意したscriptを使います。
また、cache_directoriesでCarthageを持っておくのがポイントです。

circle.yml
dependencies:
  override:
    - . script/install
  cache_directories:
    - "Carthage"

参考

ほぼこれに近いです
https://robots.thoughtbot.com/caching-carthage-con-circleci

25
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
20