Travis CI skip tests (Gradle Android project)

[亡魂溺海] 提交于 2019-12-07 04:51:30

问题


Now I'm configuring Travis CI for my Gradle-based Android project. Is it possible to temporary disable tests launch from Travis to just know - if project could be built or not?


回答1:


By default, Travis-ci executes ./gradlew build connectedCheck if no script: section is found.

Failed tests are ignored if you add the next code to all your tested modules (build.gradle files).

project.gradle.taskGraph.whenReady {
    connectedAndroidTest {
        ignoreFailures = true
    }
}

Another option is to skip the install stage and only to use ./gradlew build (or ./gradle build without gradle wrapper) so tests are not performed.

install:
  # Check install section: http://docs.travis-ci.com/user/build-configuration/#install
  # If you'd like to skip the install stage entirely, set it to true and nothing will be run.
  - true

script:
  # By default Travis-ci executes './gradlew build connectedCheck' if no 'script:' section found.
  - ./gradlew build

You can use the -x command line argument which excludes any task (see this answer).

gradle build -x test 



回答2:


Check output of

./gradlew tasks

and then use:

./gradlew assemble

Like in this thread: Gradle build without tests



来源:https://stackoverflow.com/questions/26800944/travis-ci-skip-tests-gradle-android-project

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