Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display HTML-formatted output files in Travis?

I'm trying to deploy an Android library on Bintray using Travis-CI. But when I upload my repo... I got this:

Ran lint on variant release: 6 issues found

Ran lint on variant debug: 6 issues found

Wrote HTML report to file:///home/travis/build/leandroBorgesFerreira/MoreCLoseButton/app/build/outputs/lint-results-debug.html

Wrote XML report to file:///home/travis/build/leandroBorgesFerreira/MoreCLoseButton/app/build/outputs/lint-results-debug.xml

:app:lint FAILED

Normally I would go to my project out put and read the lint-results-debug.html... But I don't know how to access this file in Travis.

So, How can I access outputs/lint-results-debug.html in Travis??

Any help is welcome!

Edit

my .travis.yml:

language: android
jdk: oraclejdk8
sudo: false

addons:
  apt:
    packages:
      - lynx

android:
  components:
  - platform-tools
  - tools
  - build-tools-25.0.0
  - android-25
  - extra-android-m2repository
script: 
  - if [ -f /home/travis/build/leandroBorgesFerreira/MoreCLoseButton/app/build/outputs/lint-results-debug.html ]; then lynx -dump /home/travis/build/leandroBorgesFerreira/MoreCLoseButton/app/build/outputs/lint-results-debug.html; fi
  - ./gradlew -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" build
  bintrayUpload --stacktrace --info
env:
  global:
  - secure: [...]
  - secure: [...]
like image 907
Leandro Borges Ferreira Avatar asked Dec 05 '16 02:12

Leandro Borges Ferreira


2 Answers

You can use lynx -dump to dump a plain-text rendering of any HTML file output from a Travis run.

To make Travis install lynx -dump: To the top of your .travis.yml, add this:

addons:
  apt:
    packages:
      - lynx

Assuming the HTML file is an error log of some kind, you can make Travis show the output by putting something like the following in the script part of your .travis.yml:

after_failure:
  - if [ -f /home/travis/build/…/foo.html ]; then lynx -dump /home/travis/build/…/foo.html; fi
like image 120
sideshowbarker Avatar answered Oct 07 '22 12:10

sideshowbarker


While sideshowbarker gave a generic answer, I'd like to point out that Android lint has an option for console output, so you can do this in your build.gradle:

android {
    lintOptions {
        textReport = true
        //textOutput "stdout" // default location, perfect for travis
    }
}

Which removes the need for an extra dependency, and an extra script; plus it's reproducible on local machine easily.

One can take this a step further (in case spamming console on local machine is to be avoided) and do

android {
    lintOptions {
        textReport = project.property("lint.output.console").toBoolean()
    }
}

and in gradle.properties: lint.output.console=false

and in .travis.yml: gradlew -Plint.output.console=true build

like image 29
TWiStErRob Avatar answered Oct 07 '22 14:10

TWiStErRob