Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): added kover plugin for coverage #2267

Merged
merged 25 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a3c127a
added kotlinx plugin to auth build file
Jan 17, 2023
7b8fd6e
Merge branch 'main' into feature/fix-test-coverage
gpanshu Feb 1, 2023
f820150
Merge branch 'main' into feature/fix-test-coverage
gpanshu Feb 1, 2023
33833fc
add kover report to library plugins
Feb 1, 2023
d3ec699
Merge remote-tracking branch 'origin/feature/fix-test-coverage' into …
Feb 1, 2023
0774f25
Merge branch 'main' into feature/fix-test-coverage
banji180 Feb 1, 2023
8ae96de
added kover to project
Feb 2, 2023
92ddf55
Merge remote-tracking branch 'origin/feature/fix-test-coverage' into …
Feb 2, 2023
fddac90
added kover to project
Feb 2, 2023
ed313ad
Merge remote-tracking branch 'origin/main' into feature/fix-test-cove…
Feb 2, 2023
e7b4573
added kover plugin to gradle file
Feb 2, 2023
c2dc7e3
added kover plugin to gradle file
Feb 2, 2023
99f3a6d
fixed lint issue
Feb 6, 2023
dfd7264
fixed review comments
Feb 6, 2023
e2db09a
fixed review comments
Feb 6, 2023
99608e3
fixed review comments
Feb 6, 2023
8103c55
fixed review comments
Feb 7, 2023
4f25dd1
fixed review comments
Feb 7, 2023
94812bb
Merge branch 'main' into feature/fix-test-coverage
banji180 Feb 7, 2023
f58a615
fixed review comments
Feb 8, 2023
9cd8e91
added exclude package to kover
Feb 8, 2023
d0f2b31
Merge branch 'main' into feature/fix-test-coverage
banji180 Feb 8, 2023
aaee3cf
added exclude package to kover
Feb 9, 2023
3a0c2f3
Merge remote-tracking branch 'origin/feature/fix-test-coverage' into …
Feb 9, 2023
f8c637a
Merge branch 'main' into feature/fix-test-coverage
banji180 Feb 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/codecov_code_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ jobs:
java-version: '11'
distribution: 'corretto'

- name: Run test and generate jacoco report
run: ./gradlew jacocoTestReport
- name: Run test and generate kover report
run: ./gradlew koverReport

- name: create temp directory
run: mkdir /home/runner/work/amplify-android/amplify-android/code-coverage

- name: copy jacoco test report to temp directory
run: cp -r /home/runner/work/amplify-android/amplify-android/**/build/coverage-report/*.xml /home/runner/work/amplify-android/amplify-android/code-coverage/
- name: copy kover test report to temp directory
run: cp -r /home/runner/work/amplify-android/amplify-android/**/build/reports/kover/xml/*.xml /home/runner/work/amplify-android/amplify-android/code-coverage/

- name: Upload Test Report
uses: codecov/codecov-action@v3
Expand Down
5 changes: 3 additions & 2 deletions aws-auth-cognito/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ dependencies {
testImplementation(project(":testutils"))
testImplementation(project(":aws-auth-cognito"))
//noinspection GradleDependency
testImplementation("org.json:json:20180813")
testImplementation(testDependency.json)

testImplementation(testDependency.kotlin.test.junit)
testImplementation(testDependency.kotlin.test.kotlinTest)
testImplementation(testDependency.kotlin.test.coroutines)
Expand All @@ -53,7 +54,7 @@ dependencies {

androidTestImplementation(dependency.gson)
//noinspection GradleDependency
androidTestImplementation("com.amazonaws:aws-android-sdk-core:2.55.0")
banji180 marked this conversation as resolved.
Show resolved Hide resolved
androidTestImplementation(dependency.com.amazonaws.aws.sdk.core)
androidTestImplementation(testDependency.androidx.test.runner)
androidTestImplementation(testDependency.androidx.test.junit)
androidTestImplementation(project(":testutils"))
Expand Down
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ buildscript {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.10")
classpath("org.jlleitschuh.gradle:ktlint-gradle:11.0.0")
classpath("org.gradle:test-retry-gradle-plugin:1.4.1")
classpath("org.jetbrains.kotlinx:kover:0.6.1")
}
}

Expand Down Expand Up @@ -71,7 +72,7 @@ subprojects {

afterEvaluate {
configureAndroid()
apply(from = "../jacoco.gradle")
apply(from = "../kover.gradle")
}

if (!name.contains("test")) {
Expand Down
20 changes: 0 additions & 20 deletions jacoco-config.gradle

This file was deleted.

132 changes: 0 additions & 132 deletions jacoco.gradle

This file was deleted.

44 changes: 44 additions & 0 deletions kover.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apply plugin: 'kover'

project.ext {
ignoreModuleList = [
'testutils',
'testmodels'
]

// Exclude file by names, packages or types. Such files will be ignored during test coverage
// calculation
ignoreFileFilter = [
'**/*App.*',
'**/*Application.*',
'**/*Activity.*',
'**/*Fragment.*',
'**/*View.*',
'**/*ViewGroup.*',
'**/*JsonAdapter.*',
'**/di/**',
'**/*Dagger.*'
]
}

kover{
instrumentation {
// exclude jdk internals from instrumentation
excludeTasks.add "jdk.internal.*"
}

xmlReport {
// set to true to run koverXmlReport task during the execution of the check task (if it exists) of the current project
onCheck.set false

// change report file name
reportFile.set layout.buildDirectory.file("reports/kover/xml/${project.name}.xml")
overrideFilters {
// override common class filter
classes {
// override class exclusion rules
excludes.addAll ignoreModuleList + ignoreFileFilter
}
}
}
}
4 changes: 4 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ dependencyResolutionManagement {
library("mockwebserver", "com.squareup.okhttp3:mockwebserver:5.0.0-alpha.9")
library("robolectric", "org.robolectric:robolectric:4.7")
library("jsonassert", "org.skyscreamer:jsonassert:1.5.0")
library("json", "org.json:json:20210307")
}
// Library dependencies
create("dependency") {
Expand All @@ -85,6 +86,9 @@ dependencyResolutionManagement {
// AWS
val awsKotlinSdk = "awsKotlinSdk"
version(awsKotlinSdk, "0.17.12-beta")

library("com.amazonaws.aws.sdk.core", "com.amazonaws:aws-android-sdk-core:2.62.2")
banji180 marked this conversation as resolved.
Show resolved Hide resolved

library("aws-credentials", "aws.smithy.kotlin:aws-credentials:0.12.6")
library("aws-ktor", "aws.smithy.kotlin:http-client-engine-ktor:0.7.7")
library("aws-signing", "aws.smithy.kotlin:aws-signing-default:0.12.6")
Expand Down