Continuous Integration and Deployment through Circle CI

On small or casual projects, developers can do tasks manually with regards to building projects, testing and deployment. But this quickly creates a very big headache when you reach to a point of complexity or have big team of developers working together. on same project

Missing any steps along the way can cause multiple issues, like incorrect merge or a code block being change by someone and breaking other components, unit tests not being properly run, or forgetting to upload a file during a deployment (yuck!) which can bring down an entire projectbuild.

We use various tools like earlier we had Buddy Build Integration but as we migrated to higher API versions it became useless.So requirement came up for something which does the same but at the same time no dedicated server being required along with the pricing factors when we just had a single app with less build time.

CircleCI came out to be a best fit for all our requirements.Let’s checkout out the CircleCi workflow:

  • Developer completes the task development and push it into repository.

Many tools are present for continuous integration and deployment like Jenkins, Travis CI etc. But some interesting features of Circle CI make it suit to your requirement if you want to complete integration in short span of time.

  • Circle Ci is a cloud based system hence no requirement of setting up a dedicated server, no dev-ops requirement.

Circle CI compatiblity:

  • Python, Node.js, Ruby, Java, Go, etc.

Circle CI Pros:

  • Circle CI has a free plan for enterprise projects.

Circle CI Cons:

  • Circle CI supports only 2 versions of Ubuntu for free (12.04 и 14.04) and Mac OS as a paid part.

Go , Haskell, Java, PHP, Python, Ruby/Rails, Scala

  • Some problems may appear in case you would like to make customizations: you may need some 3rd party software to make those adjustments.

Circle CI set up:

Getting started with Circle CI was easy, just need to login with Bitbucket or Github account.Once login is done need to manage the projects and then set it up.

Choose the environment you wish to work upon,we chose Linux for our app and started building the needfuls.

CONFIG Walkthrough

Circle CI is easy just need to add a config file that satisfies all the requirements.At Rubique we chose:


In config we have a jobs key. Each job represents a phase in your Build-Test-Deploy process. Our app only needs a build job, so everything else is going to live under that key. In each job, we have the option of specifying a working_directory. This is the directory into which our code will be checked out, and this path will be used as the default working directory .

- image: circleci/android:api-27-alpha

We use the CircleCI-provided Android image with the api-27-alpha tag it directly links to our compileSDKVersion.

After that add several steps within the build job.We start with checkout so we can operate on the codebase.Next we pull down the cache, if present. If this is going to be your first run, or if you’ve changed either of your build.gradle files, this won’t do anything. We run ./gradlew androidDependencies next to pull down the project’s dependencies. Normally you never call this task directly since it’s done automatically when it’s needed, but calling it directly allows us to insert a save_cache step that will store the dependencies in order to speed things up for next time.

Build Apk
command: ./gradlew build -PpreDexEnable=false -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms3584m -Xmx3584m"

We added specific task to build Apk and then modifed the function so that it runs in 4g environment of Circle CI else GC overhead error stops the execution of script if your app required more than 4gb.If needed more you can connect to Circle CI team.

Then ./gradlew lint test runs the unit tests, and runs the built in linting tools to check your code for style issues.

At Rubique we use Slack for all our internal communication , so added one more process to upload this apk on slack automatically so that testers can directly access it.Slack has nice support of Circle CI integrated. If want we can upload apk on firebase or google drive as per requirements.

For Slack it requires Slack token and slack channel name .

- run:
Upload to Slack
command: |
export apk_name="build-${CIRCLE_BRANCH}-`git rev-parse --short HEAD`.apk"
curl -F token="${SLACK_TOKEN}" -F channels="${SLACK_CHANNEL}" -F title="${apk_name}" -F filename="${apk_name}" -F file=@app/build/outputs/apk/debug/app-debug.apk

If all goes well then you can check every step result at Circle CI console.Once done successful the build will be directly uploaded on Slack.

At Rubique we believe to deliver financial services at ease to our user so Circle CI facilitates it by giving us all overview of errors or warnings in the project so the team can fix it and deliver seamlessly to users.



@GoogleDevExpert Firebase, WTM Ambassador,

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store