Veritrans Android SDK Continous Integration and Automated Test

Veritrans Android SDK is open source project.

Continous integration (CI) is required to make sure change from another contributor is not breaking current implementation.

We use CircleCi as cloud continous integration service because it's easy to setup and also free.

Basically CI configuration was in a single file.
This is latest configuration in Veritrans Android project.

# Build configuration for Circle CI

        - /home/ubuntu/veritrans-android/sdk-example/build/outputs/apk/

        version: 2.0.0-p648
        ANDROID_HOME: /usr/local/android-sdk-linux
        GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:MaxPermSize=1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError"'
        _JAVA_OPTIONS: "-Xms512m -Xmx2048m"
        # Installing auto bumping version tools
        - gem install bmp
        # Copy environment variables to
        - source && copyEnvVarsToGradleProperties
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-23.0.3,android-23,extra-google-m2repository,extra-google-google_play_services,extra-android-m2repository
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

        # Build
       - (./gradlew corekit:testDevelopmentDebugUnitTestCoverage -PdisablePreDex):
            timeout: 3600

       - cp -r corekit/build/reports $CIRCLE_ARTIFACTS
       - cp -r corekit/build/reports/ $CIRCLE_TEST_REPORTS

# Deployment section
        tag: /v[0-9]+(\.[0-9]+)*/
        owner: veritrans
            - ./gradlew :clean :corekit:assembleRelease :corekit:bintrayUpload -PdisablePreDex
            - ./gradlew :clean :uikit:assembleRelease :uikit:bintrayUpload -PdisablePreDex
            - ./gradlew :clean :scancard:assembleRelease :scancard:bintrayUpload -PdisablePreDex
            - ./gradlew :clean :widgets:assembleRelease :widgets:bintrayUpload -PdisablePreDex
            # using ghr to release latest version to github
            - ./gradlew :clean :sdk-example:assembleDevelopmentDebug -PdisablePredex
            - go get
            - ghr -t $GITHUB_TOKEN -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME --replace --prerelease `git describe --tags` sdk-example/build/outputs/apk/

      branch: release
      owner: veritrans
            - bmp -p
            - source && setGit
            - bmp -c
            - git checkout master && git merge release
            - git push origin master --tag

General section

This section was used to define variables to be used in all sections in CI.

Machine section

This section was used to define machine configuration for all activities in this CI.

Dependencies section

This section was used to define step to fetch dependencies before build and test step.

Test section

The configuration was made so it will check any change in any branch by build the library and run the unit test.

If failed, it will notify github that the check on specific commit was failed. It will help contributor know what's wrong with their works.

Deployment section

Also CircleCI will check every change in release branch so if it's success it will be automatically bump version, add a new tag and push to master branch. Whenever a new tag was created, CircleCI will deploy the code to bintray if the test was succeeded.

This will be helpful to contributor so they don't need to publish every change manually to bintray.

Artikel - Artikel Terkait