How to get surefire reports form Travis-CI build?

前端 未结 4 801
一个人的身影
一个人的身影 2021-01-12 21:40

The question says it all really. How can I download or view the surefire-reports generated during a build on Travis?

相关标签:
4条回答
  • 2021-01-12 21:59

    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

    0 讨论(0)
  • 2021-01-12 22:01

    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
    
    0 讨论(0)
  • 2021-01-12 22:01

    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

    0 讨论(0)
  • 2021-01-12 22:02

    You can just do

    after_failure:
      - cat target/surefire-reports/*.txt
    
    0 讨论(0)
提交回复
热议问题