Get The Latest Articles In Your Inbox.

Join the other 2000+ savvy node.js developers who get article updates. You will receive only high-quality articles about Node.js, Cloud Computing and Javascript front-end frameworks. Unsubscribe anytime.

/Devops

It's Here! Simple Ionic app build automation with new CircleCI 2.0

Do you struggle to generate APK for your Ionic App?

I use to work for a company where we have a hybrid mobile app, we made it with Ionic Framework (version 2).

The problem was only one developer and one computer could generate the APK, this was a bottleneck especially when we were in a rush to complete the sprint and the QA Team needed several APK.

do more work

You know how is this, maybe the change requested by the QA team was only a change of text but we had to wait for that developer to be free to generate an APK.

It’s hard to setup your computer for this task

As you may experience, making an APK on your machine can be difficult, you need to install Android Studio or at least Android SDK Manager, spend some time downloading the 20GB SDKs, fighting with your almost completed MBP’s SSD because of videos from your last holiday.

do more work

Even if you can handle all that trouble, maybe your coworkers don’t, and you will become that guy who can generate the APK, they always will depend upon you or your computer.

👉 GET MORE ADVANCED node.js DEVELOPMENT ARTICLES

Join the other 2,000+ savvy node.js developers who get article updates.

No Spam🤞. Unsubscribe anytime.

Introducing automated APK generation with CircleCI and Docker

Here come continuous delivery practices to solve your problems. With the help of my friend CircleCI and the amazing Docker technology, you can pass the responsibility to them and forget about manually generating ionic mobile app APKs for the QA team. Now even you can run your automation testing suit.

With CircleCI you have:

  • No more buggy ionic mobile app APKs, run automation testing and then generate APK

  • Save ~10 minutes from every ionic mobile app APK generation.

  • Independence, no more sharing a file through airdrop, just use the download link from CircleCi dashboard.

  • Totally free

It took me several attempts…

failed attempts to build apk with circleci

But here I have a the CircleCi config.yml ready for you, so don’t have to fight with the Java, Gradle and Android Studio problems.

version: 2
jobs:
build:
docker:
- image: circleci/android:api-28-node
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- run:
name: "Install gradle"
command: |
wget https://services.gradle.org/distributions/gradle-4.0.2-bin.zip -P /tmp
sudo unzip -d /opt/gradle /tmp/gradle-*.zip
echo 'export GRADLE_HOME=/opt/gradle/gradle-4.0.2' >> $BASH_ENV
echo 'export PATH=$PATH:/opt/gradle/gradle-4.0.2/bin' >> $BASH_ENV
source $BASH_ENV
- run:
name: "Install ionic and cordova"
command: |
sudo npm install -g ionic cordova yarn
- run:
name: "Install npm packages"
command: |
yarn install
- run:
name: "Install Cordova plugins and add android platform"
command: |
ionic cordova platform add android --noresources
ionic config set -g telemetry true
- run:
name: "Generate apk"
command: |
ionic cordova build android --verbose
mkdir -p /tmp/apk
cp -r platforms/android/app/build/outputs/apk/debug/app-debug.apk /tmp/apk
- store_artifacts:
path: /tmp/apk
destination: apks
workflows:
version: 2
build_and_deploy:
jobs:
- build
view raw config.yml hosted with ❤ by GitHub

Now the job will generate an APK and save it to the CircleCI Artifacts location, at the time of writing you can save up to 3GB.

artifact file generated by circleci

Conclusion

The power of continuous integration and continuous delivery tools like CircleCI and Docker can help you save tons of time, therefore tons of money.

You can go further and optimize the CircleCI configuration to make use of the cache layer.

Even you can set up Google Drive (or Dropbox or an FTP) integration so the QA Team doesn’t have to enter to CircleCI to download the file.

In a future post, we will discuss how to use CircleCI to automate API Testing before your server goes to production, this will give you peace of mind, believe me.

Resources

Get The Latest Articles In Your Inbox.

Join the other 2000+ savvy node.js developers who get article updates.

You will receive only high-quality articles about Node.js, Cloud Computing and Javascript front-end frameworks.

Unsubscribe anytime.

santypk4

Santiago Quinteros - @santypk4

I wish they read the docs

Read More
Latest Posts
Latest Open Source Projects
About us
Software on The Road LLC contact@softwareontheroad.com
Software on The Road
coding the future

Hire us