Merge pull request #56 from kirmanak/implement-coverage
Enable code coverage calculation
This commit is contained in:
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: ./gradlew check sonarqube --no-daemon
|
run: ./gradlew check coverageReport sonarqube --no-daemon
|
||||||
|
|
||||||
- name: Publish test reports
|
- name: Publish test reports
|
||||||
uses: mikepenz/action-junit-report@v2
|
uses: mikepenz/action-junit-report@v2
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ plugins {
|
|||||||
id 'org.jetbrains.kotlin.plugin.serialization'
|
id 'org.jetbrains.kotlin.plugin.serialization'
|
||||||
id 'com.google.gms.google-services'
|
id 'com.google.gms.google-services'
|
||||||
id 'com.google.firebase.crashlytics'
|
id 'com.google.firebase.crashlytics'
|
||||||
id 'com.google.firebase.firebase-perf'
|
|
||||||
// https://plugins.gradle.org/plugin/com.guardsquare.appsweep
|
// https://plugins.gradle.org/plugin/com.guardsquare.appsweep
|
||||||
id "com.guardsquare.appsweep" version "1.0.0"
|
id "com.guardsquare.appsweep" version "1.0.0"
|
||||||
}
|
}
|
||||||
@@ -54,6 +53,7 @@ android {
|
|||||||
debug {
|
debug {
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
shrinkResources true
|
shrinkResources true
|
||||||
|
testCoverageEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro'
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
@@ -71,6 +71,12 @@ android {
|
|||||||
testOptions {
|
testOptions {
|
||||||
unitTests {
|
unitTests {
|
||||||
includeAndroidResources = true
|
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 platform("com.google.firebase:firebase-bom:30.0.2")
|
||||||
implementation "com.google.firebase:firebase-analytics-ktx"
|
implementation "com.google.firebase:firebase-analytics-ktx"
|
||||||
implementation "com.google.firebase:firebase-crashlytics-ktx"
|
implementation "com.google.firebase:firebase-crashlytics-ktx"
|
||||||
implementation "com.google.firebase:firebase-perf-ktx"
|
|
||||||
|
|
||||||
// https://github.com/junit-team/junit4/releases
|
// https://github.com/junit-team/junit4/releases
|
||||||
testImplementation "junit:junit:4.13.2"
|
testImplementation "junit:junit:4.13.2"
|
||||||
@@ -211,5 +216,4 @@ dependencies {
|
|||||||
|
|
||||||
// https://github.com/square/leakcanary/releases
|
// https://github.com/square/leakcanary/releases
|
||||||
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
|
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,8 @@ buildscript {
|
|||||||
plugins {
|
plugins {
|
||||||
// https://plugins.gradle.org/plugin/org.sonarqube
|
// https://plugins.gradle.org/plugin/org.sonarqube
|
||||||
id "org.sonarqube" version "3.3"
|
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) {
|
task clean(type: Delete) {
|
||||||
@@ -46,5 +48,10 @@ sonarqube {
|
|||||||
property "sonar.organization", "kirmanak"
|
property "sonar.organization", "kirmanak"
|
||||||
property "sonar.host.url", "https://sonarcloud.io"
|
property "sonar.host.url", "https://sonarcloud.io"
|
||||||
property "sonar.androidLint.reportPaths", "build/reports/lint-results-debug.xml"
|
property "sonar.androidLint.reportPaths", "build/reports/lint-results-debug.xml"
|
||||||
|
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco.xml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootCoverage {
|
||||||
|
generateXml true
|
||||||
|
}
|
||||||
2
lint.xml
2
lint.xml
@@ -2,5 +2,7 @@
|
|||||||
<lint>
|
<lint>
|
||||||
<issue id="InvalidPackage">
|
<issue id="InvalidPackage">
|
||||||
<ignore regexp="kotlinx.coroutines.debug.AgentPremain" />
|
<ignore regexp="kotlinx.coroutines.debug.AgentPremain" />
|
||||||
|
<ignore regexp="java.lang.management" />
|
||||||
|
<ignore regexp="javax.management" />
|
||||||
</issue>
|
</issue>
|
||||||
</lint>
|
</lint>
|
||||||
Reference in New Issue
Block a user