在 travis-ci 失败时上传要点 [英] Upload gist upon travis-ci failure

查看:36
本文介绍了在 travis-ci 失败时上传要点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开源项目,我想使用 travis-ci 对其进行测试.可悲的是,它相当脆弱,我想知道原因.测试编写了非常冗长的日志文件,所以我想在 Github Gist 失败时将这些文件导出.有一些命令行工具允许我这样做,例如 gist-paste,但是我不知道如何仅在失败时运行它们并且不覆盖单元测试的返回码,即,我仍然希望 travis-ci 注意到失败.

I have an open source project that I'd like to test using travis-ci. Sadly it is rather flaky and I'd like to know the reason. The tests write very verbose log files, so I'd like to export these, upon failure to Github Gist. There are command line tools that allow me to do that, gist-paste for instance, however I don't know how to run them only upon failure and without overriding the return code of the unittests, i.e., I'd still like travis-ci to notice the failure.

推荐答案

好主意.Travis CI 在构建生命周期中有一个名为 after_failure 的步骤,它将在您的测试 script 步骤运行并失败后触发,如 自定义构建"文档页面在这里.

Great idea. Travis CI has a step in the build lifecycle called after_failure which will be fired after your testing script step has run and failed, as outlined on the "customizing the build" documentation page here.

在您的 .travis.yml 文件中,您将在设置后添加一个 after_failure 步骤并调用您的 gist-paste 命令相关的 Git 令牌作为我假设的加密环境变量.然后,您可以从 Travis 设置的许多环境变量中访问有关构建的大量信息构建.

In your .travis.yml file, you would add an after_failure step with a call to your gist-paste command, after setting the relevant Git tokens as encrypted environment variables I assume. You can then access plenty of information about the build from the many environment variables set by Travis during the build.

这篇关于在 travis-ci 失败时上传要点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆