あちらこちらで目にするCI
の経験がないので、今更ながら
GitHub上のiOSプロジェクトでもTravis CI × CodecovでCIしたい!
を参考にTravis CIを試してみた。
色々なサイトを調べて一番シンプルな.travis.yml
はこんな感じになった。
.travis.yml
language: objective-c
osx_image: xcode8.3
before_install:
# - brew update
# - brew install carthage
- carthage bootstrap --platform ios
script:
- xcodebuild test -scheme CIWorkflowSample -configuration Debug -destination 'platform=iOS Simulator,OS=10.3,name=iPhone 7 Plus' | bundle exec xcpretty -c
設定した内容は
-
Carthage
を利用 -
Carthage
を利用するためのHomebrew
の設定は不要
brew install carthage
したらエラーになったのでbrew
系コマンドは削除。もし必要ならCarthage
をアップデートしてもよさそう。
Error: carthage 0.20.1 is already installed
To upgrade to 0.22.0, run `brew upgrade carthage`
- Travis CIのログ制限に引っかかるということなので
xcpretty
を利用 -
xcpretty
をインストールするためにBundler
を利用する。 -
Bundler
を利用していてプロジェクトのルートにGemfile
がある場合は
If there is a Gemfile in your project’s root directory, the pod command is not executed, but instead Bundler is used as a wrapper to pod as follows:
bundle exec pod install
「bundle exec
を利用しろ」とあるので(Dependency Management)、xcpretty
もbundle exec xcpretty
で実行する
-
-destination
に設定する内容は以下のようなコマンドを実行してエラーで一覧を表示させて調べる。
xcodebuild test -scheme CIWorkflowSample -destination 'foo=bar'