mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Update jacoco and github actions (#4639)
* Fix jacoco setup * Fix task name * Update CI yml file for codecov * Fix syntax error * Use all branch instead of just master * Fix report upload issue * Remove returnDefaultValues * Add Github Action and Codecov badge
This commit is contained in:
parent
fea5abd802
commit
b1f06ad9bc
6 changed files with 69 additions and 6 deletions
7
.github/workflows/android.yml
vendored
7
.github/workflows/android.yml
vendored
|
|
@ -1,7 +1,6 @@
|
||||||
name: Android CI
|
name: Android CI
|
||||||
|
|
||||||
on:
|
on: [push, pull_request]
|
||||||
push
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
@ -14,4 +13,6 @@ jobs:
|
||||||
with:
|
with:
|
||||||
java-version: 1.8
|
java-version: 1.8
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew -Pcoverage jacocoTestBetaDebugUnitTestReport
|
run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage
|
||||||
|
- name: Upload Test Report
|
||||||
|
run: bash <(curl -s https://codecov.io/bash) -f "app/build/reports/jacoco/testBetaDebugUnitTestCoverage/testBetaDebugUnitTestCoverage.xml"
|
||||||
|
|
@ -23,7 +23,7 @@ android:
|
||||||
licenses:
|
licenses:
|
||||||
- android-sdk-license-.+
|
- android-sdk-license-.+
|
||||||
script:
|
script:
|
||||||
- "./gradlew -Pcoverage jacocoTestBetaDebugUnitTestReport"
|
- "./gradlew -Pcoverage testBetaDebugUnitTestCoverage"
|
||||||
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then
|
||||||
mkdir -p app/src/prodRelease/play/release-notes/en-US;
|
mkdir -p app/src/prodRelease/play/release-notes/en-US;
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
# Wikimedia Commons Android app
|
# Wikimedia Commons Android app
|
||||||
[](https://travis-ci.org/commons-app/apps-android-commons)
|
[](https://travis-ci.org/commons-app/apps-android-commons)
|
||||||
|
[](https://github.com/commons-app/apps-android-commons/actions?query=branch%3Amaster)
|
||||||
[](https://appetize.io/app/8ywtpe9f8tb8h6bey11c92vkcw)
|
[](https://appetize.io/app/8ywtpe9f8tb8h6bey11c92vkcw)
|
||||||
|
[](https://codecov.io/gh/commons-app/apps-android-commons)
|
||||||
|
|
||||||
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].
|
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,7 +6,7 @@ apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
apply plugin: "com.hiya.jacoco-android"
|
apply from: "$rootDir/jacoco.gradle"
|
||||||
|
|
||||||
def isRunningOnTravisAndIsNotPRBuild = System.getenv("CI") == "true" && file('../play.p12').exists()
|
def isRunningOnTravisAndIsNotPRBuild = System.getenv("CI") == "true" && file('../play.p12').exists()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ buildscript {
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||||
classpath "com.hiya:jacoco-android:0.2"
|
|
||||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION"
|
||||||
classpath 'org.codehaus.groovy:groovy-all:2.4.15'
|
classpath 'org.codehaus.groovy:groovy-all:2.4.15'
|
||||||
|
|
|
||||||
61
jacoco.gradle
Normal file
61
jacoco.gradle
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
apply plugin: 'jacoco'
|
||||||
|
|
||||||
|
jacoco {
|
||||||
|
toolVersion = "0.8.7"
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
testOptions {
|
||||||
|
unitTests.all {
|
||||||
|
jacoco {
|
||||||
|
includeNoLocationClasses = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project.afterEvaluate {
|
||||||
|
|
||||||
|
android.applicationVariants.all { variant ->
|
||||||
|
def name = variant.name
|
||||||
|
def testTaskName = "test${name.capitalize()}UnitTest"
|
||||||
|
|
||||||
|
tasks.create(name: "${testTaskName}Coverage", type: JacocoReport, dependsOn: "$testTaskName") {
|
||||||
|
group = "Reporting"
|
||||||
|
description = "Generate Jacoco coverage reports for the ${name.capitalize()} build."
|
||||||
|
|
||||||
|
def fileFilter = ['**/R.class',
|
||||||
|
'**/R$*.class',
|
||||||
|
'**/*$ViewInjector*.*',
|
||||||
|
'**/*$ViewBinder*.*',
|
||||||
|
'**/BuildConfig.*',
|
||||||
|
'**/Manifest*.*',
|
||||||
|
'**/*Test*.*',
|
||||||
|
'android/**/*.*']
|
||||||
|
|
||||||
|
//java compiled classes
|
||||||
|
def javaTree = fileTree(
|
||||||
|
dir: "${buildDir}/intermediates/classes/${name}",
|
||||||
|
excludes: fileFilter
|
||||||
|
)
|
||||||
|
//kotlin compiled classes
|
||||||
|
def kotlinTree = fileTree(
|
||||||
|
dir: "${buildDir}/tmp/kotlin-classes/${name}",
|
||||||
|
excludes: fileFilter
|
||||||
|
)
|
||||||
|
def mainSrc = "${project.projectDir}/src/main/java"
|
||||||
|
|
||||||
|
sourceDirectories.setFrom(files([mainSrc]))
|
||||||
|
classDirectories.setFrom(files([javaTree, kotlinTree]))
|
||||||
|
executionData.setFrom(fileTree(dir: "${buildDir}", includes: [
|
||||||
|
"jacoco/${testTaskName}.exec",
|
||||||
|
"outputs/code-coverage/connected/*coverage.ec"
|
||||||
|
]))
|
||||||
|
|
||||||
|
reports {
|
||||||
|
xml.enabled = true
|
||||||
|
html.enabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue