我已经编写了一个测试脚本,我想在我的 codeship 构建的设置命令中运行。如果它失败了,我希望它导致整个构建失败,这是单元测试之类的正常行为。
在 Travis CI 中,这似乎是 well documented :
If any of the commands in the first four stages of the build lifecycle return a non-zero exit code, the build is broken
我怎样才能在 codeship 中实现同样的行为?我尝试使用代码 1 退出我的脚本,但 codeship 保持在 a-sailin' 上。
最佳答案
以代码 1 退出确实导致构建失败,但仅在“测试命令”或“测试管道”框中。
我在“设置命令”框中错误地运行了测试。
现在我的 python 测试套件中的最后一行在代码传输中具有正确的行为:
sys.exit(0 if success else 1)
关于continuous-integration - 如何故意破坏代码构建?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33029785/