Circle CI 上で Swift 1.2 をビルド、Quick でテストする手順をまとめました。
流れとしてはこんな感じです。全部 circle.yml に記述します。
- CicleCI 上で実行する Xcode のバージョンを 6.3 に指定
- Quick, Nimble を取得
- テスト実行
1.CicleCI 上で実行する Xcode のバージョンを 6.3 に指定
Swift 1.2 が用いられたプロジェクトをビルドするには Xcode6.3系が必要です。
現在の Circle CI のデフォルトの XCode は 6.1系かなにかでそのままではビルドできないので指定します。
circle.yml
machine:
xcode:
version: "6.3.1"
参考
https://circleci.com/mobile/ios
Quick, Nimble を取得
Swift のテストフレームワークの Quick, Nimble を git submodule で追加して開発している場合、
テストする前に github から落としてくる必要があります。
circle.yml の checkout 時に実行します。
circle.yml
checkout:
post:
- git submodule sync
- git submodule update --init # use submodules
テスト実行
Circle CI のテスト実行は xctool が使われていますが、
Quick などのフレームワークをうまくロードできないようです。
xctool でテストを実行した時のエラー
━━━━
Failed to query the list of test cases in the test bundle: 2015-05-08 14:51:23.603 sim[1317:6502] /Applications/Xcode-6.3.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/sim: No simulator devices appear to be running. Setting data directories to /var/empty.
2015-05-08 14:51:23.604 sim[1317:6502] DYLD_INSERT_LIBRARIES contains possible bad values. Caller beware: /usr/local/Cellar/xctool/0.2.2/libexec/lib/otest-query-lib-ios.dylib
dlopen(/Users/distiller/Library/Developer/Xcode/DerivedData/app-ajcxbdyabbxjdehfvjcyhjeozxbd/Build/Products/Debug-iphonesimulator/appTests.xctest/appTests, 1): Library not loaded: @rpath/Nimble.framework/Nimble
Referenced from: /Users/distiller/Library/Developer/Xcode/DerivedData/app-ajcxbdyabbxjdehfvjcyhjeozxbd/Build/Products/Debug-iphonesimulator/appTests.xctest/appTests
Reason: image not found
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
そこでテスト実行時は xcodebuild で実行します。
circle.yml
test:
override:
- xcodebuild -workspace "app.xcworkspace" -scheme "schema_name" -sdk "iphonesimulator" test