File tree 6 files changed +69
-6
lines changed
6 files changed +69
-6
lines changed Original file line number Diff line number Diff line change 1
1
name : Android CI
2
2
3
- on :
4
- push
3
+ on : [push, pull_request]
5
4
6
5
jobs :
7
6
build :
14
13
with :
15
14
java-version : 1.8
16
15
- name : Build with Gradle
17
- run : ./gradlew -Pcoverage jacocoTestBetaDebugUnitTestReport
16
+ run : ./gradlew -Pcoverage testBetaDebugUnitTestCoverage
17
+ - name : Upload Test Report
18
+ run : bash <(curl -s https://codecov.io/bash) -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml"
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ android:
23
23
licenses :
24
24
- android-sdk-license-.+
25
25
script :
26
- - " ./gradlew -Pcoverage jacocoTestBetaDebugUnitTestReport "
26
+ - " ./gradlew -Pcoverage testBetaDebugUnitTestCoverage "
27
27
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
28
28
mkdir -p app/src/prodRelease/play/release-notes/en-US;
29
29
fi
Original file line number Diff line number Diff line change 1
1
# Wikimedia Commons Android app
2
2
[ ![ Build status] ( https://api.travis-ci.org/commons-app/apps-android-commons.svg?branch=master )] ( https://travis-ci.org/commons-app/apps-android-commons )
3
+ [ ![ Build status] ( https://github.com/commons-app/apps-android-commons/actions/workflows/android.yml/badge.svg?branch=master )] ( https://github.com/commons-app/apps-android-commons/actions?query=branch%3Amaster )
3
4
[ ![ Preview the app] ( https://img.shields.io/badge/Preview-Appetize.io-orange.svg )] ( https://appetize.io/app/8ywtpe9f8tb8h6bey11c92vkcw )
5
+ [ ![ codecov] ( https://codecov.io/gh/commons-app/apps-android-commons/branch/master/graph/badge.svg )] ( https://codecov.io/gh/commons-app/apps-android-commons )
4
6
5
7
The Wikimedia Commons Android app allows users to upload pictures from their Android phone/tablet to Wikimedia Commons. Download the app [ here] [ 1 ] , or view our [ website] [ 2 ] .
6
8
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ apply plugin: 'com.android.application'
6
6
apply plugin : ' kotlin-android'
7
7
apply plugin : ' kotlin-kapt'
8
8
apply plugin : ' kotlin-android-extensions'
9
- apply plugin : " com.hiya. jacoco-android "
9
+ apply from : " $r ootDir / jacoco.gradle "
10
10
11
11
def isRunningOnTravisAndIsNotPRBuild = System . getenv(" CI" ) == " true" && file(' ../play.p12' ). exists()
12
12
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ buildscript {
8
8
}
9
9
dependencies {
10
10
classpath ' com.android.tools.build:gradle:4.0.1'
11
- classpath " com.hiya:jacoco-android:0.2"
12
11
classpath ' com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
13
12
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION "
14
13
classpath ' org.codehaus.groovy:groovy-all:2.4.15'
Original file line number Diff line number Diff line change
1
+ apply plugin : ' jacoco'
2
+
3
+ jacoco {
4
+ toolVersion = " 0.8.7"
5
+ }
6
+
7
+ android {
8
+ testOptions {
9
+ unitTests. all {
10
+ jacoco {
11
+ includeNoLocationClasses = true
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ project. afterEvaluate {
18
+
19
+ android. applicationVariants. all { variant ->
20
+ def name = variant. name
21
+ def testTaskName = " test${ name.capitalize()} UnitTest"
22
+
23
+ tasks. create(name : " ${ testTaskName} Coverage" , type : JacocoReport , dependsOn : " $testTaskName " ) {
24
+ group = " Reporting"
25
+ description = " Generate Jacoco coverage reports for the ${ name.capitalize()} build."
26
+
27
+ def fileFilter = [' **/R.class' ,
28
+ ' **/R$*.class' ,
29
+ ' **/*$ViewInjector*.*' ,
30
+ ' **/*$ViewBinder*.*' ,
31
+ ' **/BuildConfig.*' ,
32
+ ' **/Manifest*.*' ,
33
+ ' **/*Test*.*' ,
34
+ ' android/**/*.*' ]
35
+
36
+ // java compiled classes
37
+ def javaTree = fileTree(
38
+ dir : " ${ buildDir} /intermediates/classes/${ name} " ,
39
+ excludes : fileFilter
40
+ )
41
+ // kotlin compiled classes
42
+ def kotlinTree = fileTree(
43
+ dir : " ${ buildDir} /tmp/kotlin-classes/${ name} " ,
44
+ excludes : fileFilter
45
+ )
46
+ def mainSrc = " ${ project.projectDir} /src/main/java"
47
+
48
+ sourceDirectories. setFrom(files([mainSrc]))
49
+ classDirectories. setFrom(files([javaTree, kotlinTree]))
50
+ executionData. setFrom(fileTree(dir : " ${ buildDir} " , includes : [
51
+ " jacoco/${ testTaskName} .exec" ,
52
+ " outputs/code-coverage/connected/*coverage.ec"
53
+ ]))
54
+
55
+ reports {
56
+ xml. enabled = true
57
+ html. enabled = true
58
+ }
59
+ }
60
+ }
61
+ }
You can’t perform that action at this time.
0 commit comments