EMIKETIC Logo

EMIKETIC Blog


EMIKETIC is a team of passionate programmers who fancy real-time and distributed application development. We write here about Meteor, React, modern JavaScript, Elixir, Phoenix and Ruby on Rails.


React Native Continuous Delivery with GitLab CI/CD and Appetize

React Native + GitLab CI/CD + Appetize

At EMIKETIC, it is important for us to provide results as fast as possible and in a convenient and easy-to-use format.

Also as a service company, we’re required to swiftly validate changes by fellow developers, QA officers, and/or clients.

Automated and continuous delivery is therefore a critical process for us. It is very feasible for web apps, but might be more challenging for mobile apps.

Our Approach to CI/CD

On most of our projects, our current approach to automated delivery is as follows:

  • Use GitLab CI/CD, a powerful continuous integration/delivery engine, to validate, test, build, and deploy any changes committed to codebase.
  • Use Appetize, an “online web based iOS Simulators and Android Emulators”, to demonstrate changes within the comfort of web browser.
  • Provide a link to downloadable build for users to install and run on their devices.

This approach is better demonstrated by our React Native Starter , our de facto boilerplate for modular and robust React Native app.

GitLab CI/CD

GitLab CI/CD is probably one of most capable CI/CD engines out there, an it is a personal favorite.

We use GitLab CI/CD descriptor (.gitlab-ci.yml) combined with a number of custom scripts and Docker images. The resulting flow looks like follows:

GitLab CI/CD Pipeline

Having your code at GitLab is not a requirement since it is possible to mirror repository from other sources.

Appetize

Appetize is very convenient tool for actually running a mobile application without having to install it on a device. It supports multiple iOS and Android devices and versions.


We use Appetize’ HTTP API to automatically upload available builds. This is done mainly the following command:

curl "https://${APPETIZE_TOKEN}@api.appetize.io/v1/apps/${APPETIZE_ID}" -F "file=@${TARGET}" -F "platform=${PLATFORM}" -F "note=${CI_COMMIT_SHA}"

Where CI_COMMIT_SHA is a git commit reference provided by GitLab CI/CD.

Downloadable Build

Providing the ability to download and install the app enables involved parties to properly validate the application in real world usage. For now, this is only possible for Android (APK).

To accomplish this requirement, we use a simplistic solution which is a shared hosting that we upload builds to using FTP, mainly with following command:

curl -u "${FTP_USERNAME}:${FTP_PASSWORD}" "ftp://${FTP_DOMAIN}${FTP_PATH}/${CI_COMMIT_REF_SLUG}/" -T $TARGET

Where CI_COMMIT_REF_SLUG is a git reference (tag or branch) provided by GitLab CI/CD.

This solution is good enough for us even when security/access is a constraint (we use .htaccess).

For more fine-grained control, we’re looking into Google Drive among other suitable candidates like Dropbox, Amazon S3, …

What’s next?

Continuous delivery is not complete while actual production build and deployment to stores remain manual. To accomplish this we’re looking into fastlane .. a subject for another blog post.