From 33fceaf8cfd4e028178b55a83926f64dab6753d7 Mon Sep 17 00:00:00 2001 From: Wellington Costa Date: Wed, 15 Nov 2017 22:21:11 -0300 Subject: [PATCH] Code coverage --- .travis.yml | 22 +++++++++++++--------- build.gradle | 1 + convalida-validators/build.gradle | 9 +++++++++ sample/build.gradle | 12 ++++++++++++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6dd4f57..deb8c82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,25 @@ language: android jdk: oraclejdk8 +env: + global: + - ANDROID_TARGET=android-23 + - ANDROID_ABI=armeabi-v7a + android: components: - tools - platform-tools - build-tools-26.0.2 - android-26 - + - sys-img-${ANDROID_ABI}-${ANDROID_TARGET} + before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - -script: ./gradlew build + +script: + - ./gradlew build test jacocoTestReport + +after_success: + - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5cced95..1739aeb 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,7 @@ buildscript { dependencies { classpath deps.android.gradlePlugin classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0' + classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2' } } diff --git a/convalida-validators/build.gradle b/convalida-validators/build.gradle index 6d14c14..92647a6 100644 --- a/convalida-validators/build.gradle +++ b/convalida-validators/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.library' +apply plugin: 'jacoco-android' apply plugin: 'com.github.dcendents.android-maven' group = 'com.github.WellingtonCosta' @@ -15,3 +16,11 @@ dependencies { implementation deps.support.design testImplementation deps.junit } + +jacocoAndroidUnitTestReport { + excludes += ['**/AbstractValidator.*'] + + csv.enabled false + html.enabled true + xml.enabled true +} \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index e8ce04b..a528b6d 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'jacoco-android' android { compileSdkVersion versions.compileSdk @@ -19,6 +20,9 @@ android { } buildTypes { + debug { + testCoverageEnabled true + } release { minifyEnabled true } @@ -42,4 +46,12 @@ dependencies { androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' +} + +jacocoAndroidUnitTestReport { + excludes += ['**/*$*.class', '**/*$*.java'] + + csv.enabled false + html.enabled true + xml.enabled true } \ No newline at end of file