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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
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.