Upload gist upon travis-ci failure

有些话、适合烂在心里 提交于 2020-01-05 06:50:55

问题


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.



来源:https://stackoverflow.com/questions/40181218/upload-gist-upon-travis-ci-failure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!