Travis构建失败,错误代码为65。

5
我在GitHub上设置了Travis CI。我用它来检查我的iOS应用程序提交情况。问题是,我经常随机遇到错误65。我还没有找到解决方法。
当任务失败后重新启动2-3次,90%的时间会通过。
之前我也遇到了日志过于详细的问题,Travis (>4MB),但我添加了xcpretty来解决这个问题。
我从日志中获取以下错误:
...
Generating 'XYZ.app.dSYM'
  error: couldn't remove '/Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app/SomeName.storyboardc' after command failed: Directory not empty
...

在Travis日志的末尾:
Testing failed:
    The file “056-Jj-FAu-view-XmS-Ro-0cO.nib” couldn’t be opened because there is no such file.
    error: couldn't remove '/Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app/SomeName.storyboardc' after command failed: Directory not empty
    error: lipo: can't move temporary file: /Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app.dSYM/Contents/Resources/DWARF/XYZ to file: /Users/travis/Library/Developer/Xcode/DerivedData/XYZ-aaltcjvmshpmlufpmzdsgbernspl/Build/Products/Debug-iphonesimulator/XYZ.app.dSYM/Contents/Resources/DWARF/XYZ.lipo (No such file or directory)
    Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil emitted errors but did not return a nonzero exit code to indicate failure
** TEST FAILED **
The following build commands failed:
    LinkStoryboards
    LinkStoryboards
(2 failures)
The command "./scripts/build.sh" exited with 65.

我正在使用Xcode 8,在Xcode和Travis设置中都是如此。


这是在不同CI上出现的问题。在网络上尝试了各种不同的方法,例如https://discuss.circleci.com/t/xcode-exit-code-65-ui-tests/7201/13。似乎在Xcode8之前,在启动instruments命令之前启动模拟器是一种hack方法。据说这种方法已经不再适用了。我还没有研究其他选项。 - MrBr
2个回答

1
啊,好问题。偶尔,在代码签名步骤中失败的xcodebuild步骤可以使用travis_retry来解决——Travis将为任何非零退出状态重试该步骤3次,这应该减少您手动重新启动的需要。在travis-ci/travis-ci GitHub问题中还提供了一些建议的代码片段。祝你好运!

是的,我正在关注那个帖子,并且也积极参与其中,你可能已经看到了:) 不幸的是,对我来说,预热模拟器并没有改变任何事情。 - Fengson

1
如果您遇到错误代码65(来自随机故障),这里有一个命令可以将其添加到您的xcodebuild末尾(假设您正在运行测试)以获取更一致的结果:

(XCODEBUILD_COMMAND_HERE) | awk 'BEGIN {success=0} $0 ~ /.* tests, with 0 failures \(.*/ {success=1} {print $0} END {if(success==0){exit 1}}

这会在输出文本中查找tests, with 0 failures (,因此使用xcodebuild的文本输出而不是xcodebuild的状态码来确定成功。

注意:请记住,如果您在代码中执行NSLog(' tests, with 0 failures (');之类的操作,可能会出现误报,但这种情况发生的可能性非常小。在更新xcodebuild之间,您可能需要更新awk脚本中的tests, with 0 failures (。但是,通过xcodebuild获得一致的结果绝对值得这个代价。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接