mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Update CI build script
This commit is contained in:
@@ -9,6 +9,7 @@ buildscript {
|
|||||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||||
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4'
|
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.4'
|
||||||
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||||
|
classpath 'org.jacoco:org.jacoco.core:+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
14
build.sh
14
build.sh
@@ -157,8 +157,12 @@ parse_instrumentation_results() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generate_coverage_badge() {
|
generate_coverage_badge() {
|
||||||
log_info "Generating code coverage badge"
|
log_info "Generating code coverage report and badge"
|
||||||
python tools/coverage-badge/badge.py -i uhabits-android/build/reports/jacoco/coverageReport/coverageReport.xml -o ${OUTPUTS_DIR}/coverage-badge
|
$GRADLE coverageReport || fail
|
||||||
|
|
||||||
|
ANDROID_REPORT=uhabits-android/build/reports/jacoco/coverageReport/coverageReport.xml
|
||||||
|
CORE_REPORT=uhabits-core/build/reports/jacoco/test/jacocoTestReport.xml
|
||||||
|
python tools/coverage-badge/badge.py -i $ANDROID_REPORT:$CORE_REPORT -o ${OUTPUTS_DIR}/coverage-badge
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_artifacts() {
|
fetch_artifacts() {
|
||||||
@@ -180,7 +184,7 @@ fetch_logcat() {
|
|||||||
|
|
||||||
run_jvm_tests() {
|
run_jvm_tests() {
|
||||||
log_info "Running JVM tests"
|
log_info "Running JVM tests"
|
||||||
$GRADLE --no-daemon coverageReport || fail
|
$GRADLE testDebugUnitTest :uhabits-core:check || fail
|
||||||
}
|
}
|
||||||
|
|
||||||
uninstall_test_apk() {
|
uninstall_test_apk() {
|
||||||
@@ -199,8 +203,8 @@ run_local_tests() {
|
|||||||
parse_instrumentation_results
|
parse_instrumentation_results
|
||||||
fetch_artifacts
|
fetch_artifacts
|
||||||
fetch_logcat
|
fetch_logcat
|
||||||
#run_jvm_tests
|
run_jvm_tests
|
||||||
#generate_coverage_badge
|
generate_coverage_badge
|
||||||
uninstall_test_apk
|
uninstall_test_apk
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,13 @@ class Devnull(object):
|
|||||||
|
|
||||||
|
|
||||||
def get_total(report):
|
def get_total(report):
|
||||||
doc = BeautifulSoup(file(report), 'xml')
|
missed = 0
|
||||||
tag = doc.select("report > counter[type^INST]")[0]
|
covered = 0
|
||||||
missed = float(tag['missed'])
|
for r in report.split(":"):
|
||||||
covered = float(tag['covered'])
|
doc = BeautifulSoup(file(r), 'xml')
|
||||||
|
tag = doc.select("report > counter[type^INST]")[0]
|
||||||
|
missed = missed + float(tag['missed'])
|
||||||
|
covered = covered + float(tag['covered'])
|
||||||
return str(int(round(100 * covered / (missed + covered))))
|
return str(int(round(100 * covered / (missed + covered))))
|
||||||
|
|
||||||
def get_color(total):
|
def get_color(total):
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ android {
|
|||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||||
}
|
}
|
||||||
|
debug {
|
||||||
|
testCoverageEnabled true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
@@ -56,7 +59,7 @@ dependencies {
|
|||||||
implementation 'com.android.support:support-v4:25.3.1'
|
implementation 'com.android.support:support-v4:25.3.1'
|
||||||
implementation 'com.getpebble:pebblekit:3.0.0'
|
implementation 'com.getpebble:pebblekit:3.0.0'
|
||||||
implementation 'com.github.paolorotolo:appintro:3.4.0'
|
implementation 'com.github.paolorotolo:appintro:3.4.0'
|
||||||
implementation 'com.google.dagger:dagger:2.11-rc2'
|
implementation 'com.google.dagger:dagger:2.9'
|
||||||
implementation 'com.jakewharton:butterknife:8.6.1-SNAPSHOT'
|
implementation 'com.jakewharton:butterknife:8.6.1-SNAPSHOT'
|
||||||
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
|
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
|
||||||
implementation 'org.apmem.tools:layouts:1.10'
|
implementation 'org.apmem.tools:layouts:1.10'
|
||||||
@@ -65,7 +68,7 @@ dependencies {
|
|||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
compileOnly 'javax.annotation:jsr250-api:1.0'
|
compileOnly 'javax.annotation:jsr250-api:1.0'
|
||||||
compileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
compileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
annotationProcessor 'com.google.dagger:dagger-compiler:2.11-rc2'
|
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
|
|
||||||
@@ -75,16 +78,18 @@ dependencies {
|
|||||||
androidTestImplementation 'com.android.support.test:runner:0.5'
|
androidTestImplementation 'com.android.support.test:runner:0.5'
|
||||||
androidTestImplementation 'com.google.guava:guava:20.0'
|
androidTestImplementation 'com.google.guava:guava:20.0'
|
||||||
androidTestCompileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
androidTestCompileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.11-rc2'
|
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
||||||
androidTestAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
androidTestAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
androidTestAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
androidTestAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
|
|
||||||
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.11-rc2'
|
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
||||||
testAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
testAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
testAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
testAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
|
|
||||||
|
testCompile 'com.google.dagger:dagger:2.9'
|
||||||
testCompile "org.mockito:mockito-core:2.8.9"
|
testCompile "org.mockito:mockito-core:2.8.9"
|
||||||
testCompile "org.mockito:mockito-inline:2.8.9"
|
testCompile "org.mockito:mockito-inline:2.8.9"
|
||||||
|
androidTestCompile 'com.google.dagger:dagger:2.9'
|
||||||
androidTestCompile "org.mockito:mockito-android:2.8.9"
|
androidTestCompile "org.mockito:mockito-android:2.8.9"
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||||
|
|
||||||
@@ -95,6 +100,42 @@ dependencies {
|
|||||||
exclude group: 'org.json', module: 'json'
|
exclude group: 'org.json', module: 'json'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task coverageReport(type: JacocoReport) {
|
||||||
|
|
||||||
|
jacocoClasspath = configurations['androidJacocoAnt']
|
||||||
|
|
||||||
|
reports {
|
||||||
|
html.enabled = true
|
||||||
|
xml.enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
def excludes = [
|
||||||
|
'**/R.class',
|
||||||
|
'**/R$*.class',
|
||||||
|
'**/BuildConfig.*',
|
||||||
|
'**/Manifest*',
|
||||||
|
'**/*Test*.*',
|
||||||
|
'**/*$Lambda$*',
|
||||||
|
'**/*$ViewBinder*',
|
||||||
|
'**/*MembersInjector*',
|
||||||
|
'**/*_Provide*',
|
||||||
|
'**/*Module_*',
|
||||||
|
'**/com/android/**/*',
|
||||||
|
'**/*Dagger*',
|
||||||
|
'**/*_Factory*'
|
||||||
|
]
|
||||||
|
|
||||||
|
def androidSrc = "${project.projectDir}/src/main/java"
|
||||||
|
def androidClasses = "${buildDir}/intermediates/classes/debug"
|
||||||
|
def jvmExecData = "${buildDir}/jacoco/testDebugUnitTest.exec"
|
||||||
|
def connectedExecData = "${buildDir}/outputs/code-coverage/connected/coverage.ec"
|
||||||
|
|
||||||
|
sourceDirectories = files(androidSrc)
|
||||||
|
classDirectories = files(fileTree(dir: androidClasses, excludes: excludes))
|
||||||
|
executionData = files(jvmExecData, connectedExecData)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user