[英]Travis CI skip tests (Gradle Android project)
Now I'm configuring Travis CI for my Gradle-based Android project. 现在我正在为基于Gradle的Android项目配置Travis CI。 Is it possible to temporary disable tests launch from Travis to just know - if project could be built or not?
是否可以临时禁用从Travis启动的测试,只知道 - 是否可以构建项目?
By default, Travis-ci executes ./gradlew build connectedCheck
if no script:
section is found. 默认情况下,如果找不到
script:
部分,Travis-ci将执行./gradlew build connectedCheck
。
Failed tests are ignored if you add the next code to all your tested modules ( build.gradle
files). 如果将下一个代码添加到所有测试模块(
build.gradle
文件),则会忽略失败的测试。
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. 另一种选择是跳过安装阶段,只使用
./gradlew build
(或./gradle build
而不使用gradle包装器),因此不执行测试。
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 ). 您可以使用
-x
命令行参数来排除任何任务( 请参阅此答案 )。
gradle build -x test
Check output of 检查输出
./gradlew tasks
and then use: 然后使用:
./gradlew assemble
Like in this thread: Gradle build without tests 就像在这个线程中: 没有测试的Gradle构建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.