Swift测试通过本地,但构建失败Travis-CI
问题描述:
我试图设置我的cocoapod项目在推送后运行它在Travis-CI上的测试。我使用xctool 0.2.4来运行测试,并且在本地执行。但只要它在Travis-CI上运行,编译构建步骤就会因为各种原因而失败,这在我看来并不能在本地重现。Swift测试通过本地,但构建失败Travis-CI
xctool test -project test/MEViewExtensions.xcodeproj -scheme MEViewExtensions -sdk iphonesimulator
这里有两个失败这在我的机器上正常工作:
-
https://travis-ci.org/materik/meviewextensions/builds/68458750
Basic Block in function '_TFE16MEViewExtensionsCSo8UIScreeng5widthV12CoreGraphics7CGFloat' does not have terminator! label %entry2 LLVM ERROR: Broken function found, compilation aborted!
-
https://travis-ci.org/materik/meviewextensions/builds/68465719
/Users/travis/build/materik/meviewextensions/test/MEViewExtensionsTests/UIViewTests.swift:22:33: error: type '@autoclosure() -> CGFloat' does not conform to protocol 'FloatLiteralConvertible' XCTAssertEqual(view2.x, 10.0)
我至少想在我的机器上得到相同的错误,以便能够进行调试。有任何想法吗?
答
问题是我正在Xcode 6.3上运行带有更新版本的Swift的测试,而Travis测试是在Xcode 6.1上运行的,而旧版本则使用了不同类型的错误。必须将osx_image: beta-xcode6.3
添加到我的.travis.yml
文件中,以便强制Travis在更高版本上运行,然后就可以了。