LoginSignup
3
3

More than 5 years have passed since last update.

iOSアプリ開発でのTravis CIを試す

Posted at

あちらこちらで目にする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)、xcprettybundle exec xcprettyで実行する

  • -destinationに設定する内容は以下のようなコマンドを実行してエラーで一覧を表示させて調べる。
    xcodebuild test -scheme CIWorkflowSample -destination 'foo=bar'

参考

3
3
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
3
3