Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 30 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,33 @@ jobs:
run: ./gradlew build
- name: Run Tests
id: tests
run: ./gradlew test
run: ./gradlew test
- name: Unit Test with Android Emulator Runner
uses: ReactiveCircus/android-emulator-runner@v2.14.3
with:
api-level: 29
script: ./gradlew testDebugUnitTest
- name: generate report
uses: actions/upload-artifact@v2
with:
name: report
path: app/build/reports/coverage/debug
# - name: Download Test Reports Folder
# uses: actions/download-artifact@v2
# with:
# name: report
# path: app/build/reports/coverage/debug
# - name: Upload Test Report
# uses: codecov/codecov-action@v2
# with:
# token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
# files: "app/build/reports/coverage/debug/report.xml"
# name: codecov-skyflow-android
# verbose: true
- name: Codecov
uses: codecov/codecov-action@v2.1.0
with:
token: ${{ secrets.CODECOV_REPO_UPLOAD_TOKEN }}
files: app/build/reports/coverage/debug/report.xml
name: codecov-skyflow-android
verbose: true
42 changes: 34 additions & 8 deletions Skyflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@ plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
id 'jacoco'
}
apply plugin: 'kotlin-android'
//group='com.github.skyflowapi'
//version = rootProject.ext.versionName

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {

reports {
xml.enabled = true
html.enabled = true
}

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories.setFrom(files([mainSrc]))
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: "$buildDir", includes: [
"jacoco/testDebugUnitTest.exec",
"outputs/code-coverage/connected/*coverage.ec"
]))
}

ext {
mGroupId = "com.skyflowapi.android"
mArtifactId = "skyflow-android-sdk"
Expand All @@ -28,27 +49,32 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}

unitTests.returnDefaultValues = true
}


buildTypes {
debug {
testCoverageEnabled true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '11'
}
}

Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.0-M1'
ext.kotlin_version = "1.4.21"
ext.jacocoVersion = '0.8.4'
repositories {
google()
mavenCentral()
Expand All @@ -10,6 +12,7 @@ buildscript {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0'
classpath "com.github.dcendents:android-maven-gradle-plugin:2.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down