Merge pull request #56 from kirmanak/implement-coverage

Enable code coverage calculation
This commit is contained in:
Kirill Kamakin
2022-06-05 16:22:50 +02:00
committed by GitHub
4 changed files with 17 additions and 4 deletions

View File

@@ -28,7 +28,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew check sonarqube --no-daemon
run: ./gradlew check coverageReport sonarqube --no-daemon
- name: Publish test reports
uses: mikepenz/action-junit-report@v2

View File

@@ -7,7 +7,6 @@ plugins {
id 'org.jetbrains.kotlin.plugin.serialization'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'com.google.firebase.firebase-perf'
// https://plugins.gradle.org/plugin/com.guardsquare.appsweep
id "com.guardsquare.appsweep" version "1.0.0"
}
@@ -54,6 +53,7 @@ android {
debug {
minifyEnabled true
shrinkResources true
testCoverageEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
}
release {
@@ -71,6 +71,12 @@ android {
testOptions {
unitTests {
includeAndroidResources = true
all {
jacoco {
includeNoLocationClasses = true
excludes = ['jdk.internal.*']
}
}
}
}
@@ -178,7 +184,6 @@ dependencies {
implementation platform("com.google.firebase:firebase-bom:30.0.2")
implementation "com.google.firebase:firebase-analytics-ktx"
implementation "com.google.firebase:firebase-crashlytics-ktx"
implementation "com.google.firebase:firebase-perf-ktx"
// https://github.com/junit-team/junit4/releases
testImplementation "junit:junit:4.13.2"
@@ -211,5 +216,4 @@ dependencies {
// https://github.com/square/leakcanary/releases
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
}

View File

@@ -34,6 +34,8 @@ buildscript {
plugins {
// https://plugins.gradle.org/plugin/org.sonarqube
id "org.sonarqube" version "3.3"
// https://plugins.gradle.org/plugin/nl.neotech.plugin.rootcoverage
id "nl.neotech.plugin.rootcoverage" version "1.5.2"
}
task clean(type: Delete) {
@@ -46,5 +48,10 @@ sonarqube {
property "sonar.organization", "kirmanak"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.androidLint.reportPaths", "build/reports/lint-results-debug.xml"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco.xml"
}
}
rootCoverage {
generateXml true
}

View File

@@ -2,5 +2,7 @@
<lint>
<issue id="InvalidPackage">
<ignore regexp="kotlinx.coroutines.debug.AgentPremain" />
<ignore regexp="java.lang.management" />
<ignore regexp="javax.management" />
</issue>
</lint>