How to get surefire reports form Travis-CI build?

半世苍凉 提交于 2019-12-01 18:10:26

You can just do

after_failure:
  - cat target/surefire-reports/*.txt

Having not found a direct way to access the surefire-report files I came up with the this workaround:

In .travis.yml I added an after_failure hook:

after_failure: print_surefire_reports.sh

In the hook print_surefire_reports.sh I put:

#!/usr/bin/env sh
echo "Current directory is $(pwd)"
echo "\n=== SUREFIRE REPORTS ===\n"

for F in target/surefire-reports/*.txt
do
    echo $F
    cat $F
    echo
done

I am using python html2text in travis after script phase.

My travis script looks like:

after_script:
- python html2text.py target/site/surefire-report.html

surefire-report.html is generated by surefire-report-plugin

See example output here: https://travis-ci.org/rmpestano/dbunit-rules/builds/160170324#L3541

Based on this bug report and this question, there is not a clean way to do this. There are, however, a couple unsupported methods of getting the reports listed in the bug report.

Those may provide options for you to look into, but the Travis CI maintainers have not provided or supported an explicit way to handle this yet. Note that those bug reports/questions are well over a year old too.

The prevailing suggestion in those threads seems to be to have Travis recommit the build artifacts back to the user's repository. This, however, requires authentication, which you probably shouldn't store in your .travis.yml file

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