From d9fd53cd59a79cc33858133effc8e4f393a0bc4e Mon Sep 17 00:00:00 2001 From: Rutvik Panchal <39809059+rutvik-panchal@users.noreply.github.com> Date: Sat, 28 Nov 2020 22:36:36 +0530 Subject: [PATCH] CI: Migrated from Travis to Github Workflows CI (#1572) --- .github/workflows/feature_branch_ci.yml | 34 +++++++++++ .github/workflows/master_dev_ci.yml | 75 +++++++++++++++++++++++++ .travis.yml | 31 ---------- README.md | 14 +++-- app/build.gradle | 1 + build.gradle | 1 + 6 files changed, 121 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/feature_branch_ci.yml create mode 100644 .github/workflows/master_dev_ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/feature_branch_ci.yml b/.github/workflows/feature_branch_ci.yml new file mode 100644 index 000000000..7dcf63954 --- /dev/null +++ b/.github/workflows/feature_branch_ci.yml @@ -0,0 +1,34 @@ +name: Workflow for feature branches + +on: + push: + branches: + - '*' + - '!development' + - '!master' + +jobs: + build: + name: Build APK + runs-on: ubuntu-latest + steps: + - name: Checking out repository + uses: actions/checkout@v2 + + # Set up JDK + - name: Set Up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + # Install NDK + - name: Install NDK + run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT} + + # Update Gradle Permission + - name: Change gradlew Permission + run: chmod +x gradlew + + # Build App + - name: Build with Gradle + run: ./gradlew assemble \ No newline at end of file diff --git a/.github/workflows/master_dev_ci.yml b/.github/workflows/master_dev_ci.yml new file mode 100644 index 000000000..4351df81c --- /dev/null +++ b/.github/workflows/master_dev_ci.yml @@ -0,0 +1,75 @@ +name: Workflow for master/development branches + +on: + pull_request: + push: + branches: + - 'development' + - 'master' + +jobs: + build: + name: Build APK + runs-on: ubuntu-latest + steps: + - name: Checking out repository + uses: actions/checkout@v2 + + # Set up JDK + - name: Set Up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + + # Install NDK + - name: Install NDK + run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT} + + # Update Gradle Permission + - name: Change gradlew Permission + run: chmod +x gradlew + + # Build App + - name: Build with Gradle + run: ./gradlew assemble + + # Upload Built APK + - name: Upload Build Artifacts + uses: actions/upload-artifact@v2.2.0 + with: + name: mifos-mobile + path: app/build/outputs/apk/debug/ + + lintCheck: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - name: Checking out repository + uses: actions/checkout@v2 + + - name: Static Analysis + run: ./gradlew lint + + - name: Upload Static Analysis Report For Mifos-Mobile Module + uses: actions/upload-artifact@v2.2.0 + if: failure() + with: + name: Static Analysis Report + path: app/build/reports/ + + pmd: + name: PMD + runs-on: ubuntu-latest + steps: + - name: Checking out repository + uses: actions/checkout@v2 + + - name: PMD Check + run: ./gradlew pmd + + - name: Upload PMD Report + uses: actions/upload-artifact@v2.2.0 + if: failure() + with: + name: PMD Report + path: app/build/reports/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8bc1e32d5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: android -jdk: oraclejdk8 -sudo: required -android: - components: - - tools - - extra-android-support - - extra-google-google_play_services - - extra-android-m2repository - - extra-google-m2repository - - build-tools-28.0.3 - - android-28 - - android-22 - - sys-img-armeabi-v7a-android-22 - -before_script: - - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & - - android-wait-for-emulator - - adb shell input keyevent 82 & - -script: "./gradlew build connectedAndroidTest --stacktrace" - -# gitter integration -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/6c1aa14ed3a3ccb5bc92 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always \ No newline at end of file diff --git a/README.md b/README.md index 2a97dff0c..6568587f9 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ An Android Application built on top of the MifosX Self-Service platform for end- ### Status -[![Join the chat at https://gitter.im/openMF/self-service-app](https://badges.gitter.im/openMF/self-service-app.svg)](https://gitter.im/openMF/self-service-app?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/openMF/mifos-mobile.svg?branch=development)](https://travis-ci.org/openMF/mifos-mobile) - +| Master | Development | Chat | +|------------|-----------------|-----------------| +| ![Mifos-Mobile CI[Master/Dev]](https://github.com/openMF/mifos-mobile/workflows/Mifos-Mobile%20CI%5BMaster/Dev%5D/badge.svg?branch=master) | ![Mifos-Mobile CI[Master/Dev]](https://github.com/openMF/mifos-mobile/workflows/Mifos-Mobile%20CI%5BMaster/Dev%5D/badge.svg?branch=development) |[![Join the chat at https://gitter.im/openMF/self-service-app](https://badges.gitter.im/openMF/self-service-app.svg)](https://gitter.im/openMF/self-service-app?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)| ## Screenshots @@ -29,7 +29,7 @@ We have the following branches : * **development** All the contributions should be pushed to this branch. If you're making a contribution, you are supposed to make a pull request to _development_. - Please make sure it passes a build check on Travis. + Please make sure it passes a build check on Github Workflows CI. It is advisable to clone only the development branch using the following command: @@ -42,6 +42,12 @@ We have the following branches : * **master** The master branch contains all the stable and bug-free working code. The development branch once complete will be merged with this branch. +To get the latest apk of master/development branch from Github Artifacts, follow these steps: +1. Go to to the [Actions](https://github.com/openMF/mifos-mobile/actions) tab of this repository. +2. Select the latest workflow for master/development branch. +3. Click on hyperlink 'mifos-mobile' in Artifacts section. +4. Extract the downloaded file and get the apk. + ## Development Setup Before you begin, you should have already downloaded the Android Studio SDK and set it up correctly. You can find a guide on how to do this here: [Setting up Android Studio](http://developer.android.com/sdk/installing/index.html?pkg=studio). diff --git a/app/build.gradle b/app/build.gradle index a8019630b..a2e9aa177 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,7 @@ apply from: '../config/quality/quality.gradle' android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion + ndkVersion rootProject.ext.ndkVersion defaultConfig { applicationId "org.mifos.mobile" diff --git a/build.gradle b/build.gradle index 9736f72bf..669c1a99e 100644 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,7 @@ ext { targetSdkVersion = 28 compileSdkVersion = 28 buildToolsVersion = '28.0.3' + ndkVersion = '21.3.6528147' // App dependencies supportLibraryVersion = '1.0.0'