Skip to content

Commit

Permalink
Merge pull request #94 from OpenSRP/github-actions-ci
Browse files Browse the repository at this point in the history
Migrate family to circle ci
  • Loading branch information
paulinembabu authored Dec 2, 2020
2 parents 42ee8ed + c1985e4 commit c201b81
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 72 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Android CI with Gradle

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
unit_tests:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install NDK
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.0.6113669" --sdk_root=${ANDROID_SDK_ROOT}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run unit tests with Gradle
run: ./gradlew :opensrp-chw-family-planning:clean :opensrp-chw-family-planning:jacocoTestReport --stacktrace
- name: Upload coverage to Coveralls with Gradle
run: ./gradlew coveralls --stacktrace
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
60 changes: 0 additions & 60 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ buildscript {
repositories {
google()
mavenCentral()
maven{ url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.10.2'
}
}

Expand Down Expand Up @@ -49,6 +51,7 @@ subprojects {
maven { url "https://repo.maven.apache.org/maven2" }
maven { url "https://cloudant.github.io/cloudant-sync-eap/repository" }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
maven{ url "https://plugins.gradle.org/m2/" }
mavenLocal()
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev
POM_SETTING_NAME=OpenSRP Client Chw Family Plannin
POM_SETTING_ARTIFACT_ID=opensrp-chw-family-planning
POM_SETTING_PACKAGING=aar
org.gradle.jvmargs=-Xmx2048M -XX\:MaxHeapSize\=32g
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 27 22:05:16 EAT 2019
#Tue Dec 01 15:03:54 EAT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
19 changes: 11 additions & 8 deletions opensrp-chw-family-planning/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath "com.android.tools.build:gradle:4.0.0"
}
}

Expand Down Expand Up @@ -72,7 +71,6 @@ android {
includeAndroidResources = true
}
}

}

tasks.withType(Test) {
Expand Down Expand Up @@ -166,18 +164,23 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'crea
getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoRootReport/html"))

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

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

tasks.coveralls {
dependsOn 'jacocoTestReport'
}

coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/merged.xml"
sourceDirs = ["$project.projectDir/src/main/java"]
}

apply from: '../maven.gradle'
3 changes: 1 addition & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
classpath "com.android.tools.build:gradle:4.0.0"
}
}

Expand Down

0 comments on commit c201b81

Please sign in to comment.