Automate your Android CI/CD Pipeline with GitHub Actions

When I came to play around with GitHub Actions CI/CD pipeline framework recently, I could not believe how simple and effective that functionality is!

It does not really matter, if you just want to automatically check each of your Git commits by using lint or to fully build your artefacts, GitHub actions allows you to do that with a simple YAML configuration.

GitHub actions allows the definition of different jobs that are automatically triggered on events happening within your Git repository (such as commits, pull, creation of a tag or releases, comments, creation of issues, and many more). As those job definitions are living in the same Git repository, its the perfect solution for managing your CI/CD pipeline as code within a self-contained GitHub repository.

Within this post, I will describe how I came to fully automate the CI/CD pipeline of my production Android App (TabShop) by using GitHub Actions.

GitHub action tab within my Android app repository

Kudos to Niraj Prajapati who wrote such a great blog post and who inspired me to fully automate my own Android app’s CI/CD pipeline.

Why – Whats the value for app publishers?

I can’t emphasise the value of a fully automated CI/CD pipeline enough! I spent hours over hours on manually building and testing my Android app, to finally sign it and push it to the Google Play Store. So far, I released 182 versions over 6 years. The build, test and release process gets more and more complex and error-prone. Freelance app publishers, like me, invest a significant amount of time into manual CI/CD processes that are much better spent in building innovations into the app itself.

That said, GitHub Actions does allow me to create and run a feature rich CI/CD release process fully automatically in the cloud, which helps me to save time and effort and to innovate!

Scope of my Android CI/CD Pipeline

This blog shows step-by-step how to implement the following tasks into your own GitHub Actions CI/CD pipeline:

  1. Build your app using the Gradle Build Tool
  2. Run your unit-tests
  3. Build a release app bundle
  4. Sign the app bundle
  5. Upload and expose the app bundle
  6. Push and release the app bundle in Google Play Console

Step 1: Automate your Android app build

The first step within our Android app’s CI/CD pipeline is to create a GitHub Action YAML file and to add a trigger that defines when the job should be run.

Navigate to your GitHub project repository and click on the ‘Actions’ tab where you find a button to create a new ‘workflow’.

GitHub offers a lot of standard build workflows for the most popular technology stacks. In our case we either choose to skip the template selection or we choose the Android CI workflow as shown below:

Choose the Android Gradle CI workflow

The resulting workflow will create an Android build job that already fulfills our first goal, which is to startup a Ubuntu instance, checkout your apps sourcecode and to execute the Gradle build file, as it is shown below:

Simple Android Gradle Build Job

The workflow above is triggered every time a ‘push’ or a ‘pull_request’ is triggered within your repository.

Step 2: Execute your unit-tests

A good unit tests coverage is recommended to safeguard your app against failing or buggy code contributions. In most Android app projects, the unit test code is part of your Git repository, so Gradle is also used to build and execute your tests by adding following step to your workflow:

Gradle step that runs your unit tests

Step 3: Build a release app bundle

Within the next step we will trigger the build of a release app bundle (AAB) that we will sign in the next step. App release bundles are the preferred way of shipping apps through the Google Play Appstore, as they are optimised in size and stripped of unnecessary content.

See below the workflow step that automatically builds our application release bundle:

Step 4: Sign the app bundle

Application bundles are typically signed with the certificate of a trustworthy app publisher, so that users can trust the origin of the installed app and that no third-party injected malicious parts into your app.

App marketplaces such as Google Play require apps to be signed with the certificate of the publisher to ensure the integrity of all published apps.

Therefore we will automatically sign our app bundle once its built by adding the below workflow step:

Sign an Android app bundle by using a GitHub action

The signing step above does need some additional information about your own certificate as well as the key store password and alias, which we will provide as safe GitHub secret placeholders as shown below:

  • secrets.SIGNING_KEY
  • secrets.ALIAS
  • secrets.KEY_STORE_PASSWORD
  • secrets.KEY_PASSWORD

Convert your certificate file into a base64 encoded string that can be used as a GitHub repository secret within the placeholder ‘secrets.SIGNING_KEY’. In case you are using a Mac you are lucky as the command for converting your secret file into a base64 encoded string is already provided by openssl, as it is shown below:

openssl base64 -in my-release-key.keystore -out my-release-key.keystore.base64

See the resulting list of GitHub secrets within the screenshot below:

GitHub Secrets used by the signing workflow step

Find the signin GitHub action that we used in our workflow below:

Step 5: Upload and expose the app bundle

Each workflow run does spin up a completely clean Ubuntu instance that is wiped after its finished.

If you would like to keep a build artefact for later download you have to define a build step to upload and persist the artefact, as it is shown below:

After your workflow is successfully finished you will find your file within the workflow execution screen:

Download Build Artefact

Step 6: Push and release the app bundle in Google Play Console

Now that we successfully built and signed our application, we would like to automatically push the app as a new beta release into your Google Play Console.

Again there is a dedicated GitHub Action that helps to achieve this cumbersome task, see below:

Another important prerequisite for a successful Google Play upload is the creation of a ‘Service account’ that holds the necessary IAM role for uploading artefacts into your Google Play account.

To create a new service account you have to navigate to your Google Play Console > Settings > API Access as it is shown in the screenshot below:

Google Play Console Service Account Creation

Create a new Service Account with release access right for your application. In case you are a Google Cloud user as well, you have to create the Service Account user within Google Cloud Console instead and then grant access to the selected app project.

Once you have your service account created, you have to create a JSON key for that service account and put it in a GitHub secret placeholder again. Just copy the JSON string into a GitHub secret field with the name ‘SERVICE_ACCOUNT_JSON’.

Create and download a JSON key for your Google Service Account

Once you have stored your service account key in a GitHub secret, you can create a workflow step to download it during the workflow run and store it in a file (service_account.json), as it is shown below:

Download the key to a local json file

The final step is to use the Upload Action to publish your application bundle to Google Play Console as it is shown below:

Upload and push an Android application bundle to Google Play

Important note here is that you will receive an error message if you did not enable the App Signing in your Google Play account. To opt-into app signing, you simply navigate to Google Play Console > Your App > Setting > App Signing, as shown below. You have to upload your signing key as private key file (which can be exported by Android Studio).

Summary

It’s amazing how easy and productive it is to use a GitHub Actions workflow to completely automate your Android app release process. It helps you to ensure consistent release quality and safes a lot of time especially for small and independent app publishers. See the running CI/CD workflow below.

Well done GitHub and Microsoft!

TabShop mobile and flexible till in your pocket

TabShop the free Android tablet and phone till and shop management app celebrates its third year within the Android play store. With over 35K users worldwide and 250K downloads during these three years TabShop stays on top of the Android business app charts. TabShop offers a flexible and modern way to personalize his own business and to checkout invoices no matter where you are offering your products or services. TabShop point of sales rich feature set allows its use within a broad spectrum of business from mobile kiosks to restaurants and bars.

Free Android till app TabShop

TabShop free android till

 

[appbox googleplay at.smartlab.tshop compact]

TabShop Point of Sale App running on Amazon’s Kindle Fire

TabShop Android Point of Sale on Amazon App market

As you all may know, also Amazon operates a global marketplace for Android Apps, as their Kindle Fire eBook devices are based on Android OS and are capable of running normal Android Apps too. So for me it was clear that TabShop Point of Sale should also be available through Amazon.

Since today TabShop also successfully received the global Amazon clearance, with all tests and reviews positively passed.

Now you are able to even convert your own eBook Kindle Fire device into a full Point of Sale cashier systems. Amazon has done a great job with offering ebooks and apps on their own Kinde Fire Android device and i think it is a cool device for converting into a retail cashier system.

Feel free and visit the TabShop Amazon product page HERE.

TabShop – Free Android Point Of Sales (POS) Software

HighRes_Image

TabShop POS is a lightweight POS kiosk cashier solution for small and medium sized storeskiosks and individual shops. Convert your Android Tablet into an intuitive and easy to use POS cashier system that saves you time, money and trouble. This Android Tablet POS software offers full configuration of local taxes, individual discounts and products.
Easily scan products by using the normal EAN or QR barcodes on your Android Tablet or click on an item to add it to your invoice list.

TabShop POS main features are:

– Manage Products and Product Categories
– Manage Taxes
– Manage Discounts
– Select Products by Scanning EAN or QR Barcodes
– Create Invoices with unique Invoice Number
– Print Invoices as PDF
– Print ASCII Invoices to Network Printer

 

Free Android TabShop Point of Sale POS App

 

Onyx Smartphone with e-Ink Display

Onyx e-Ink Android Smartphone
Onyx e-Ink Android Smartphone, image source: blog.the-ebook-reader.com

The Chinese company Onyx, which is mainly known by their Onyx-Boox ebook readers, announced these days to publish an Android smartphone that integrates an e-Ink touch display. To use e-Ink displays has several advantages as well as some major negative aspects too. As many e-Ink based ebook readers already proved, e-Ink displays offer great readability in direct sunlight. The perfect contrast of e-Ink displays is not comparable with traditional displays. Also the fact that e-Ink displays can show and persist scenes over days without using energy is a really cool feature that helps to run the Onyx smartphone for at least a week without reloading. Negative aspects of e-Ink displays are the low update frequencies and very reduced color capabilities at best, which makes it hard or even impossible to use e-Inks for multimedia applications. This Onyx phone is definitely not the best choice for multimedia evangelists but it could prove a valuable design for outdoor purposes, passionate e-book readers, travelers or elderly people with debility of sight.

Remote Controlling embedded Windows CE with RealVNC Android VNC Viewer

Today i purchased the RealVNC VNC Viewer for Android based devices, in order to test the compatibility with my MobileVNC Windows CE based VNC server. RealVNC takes €7.55 for this piece of software, which is quite high compared to the typical prices within the Google Play marketplace. Despite my initial fears, the RealVNC VNC Viewer successfully connected to my Windows CE 4.1 embedded thin client device without any complains and i was able to remote control my embedded device by using the touchscreen of my Samsung Nexus Android smartphone. The movement of the remote mouse pointer is shown by a small pixel on the smartphone, according to the fact that every touch is converted to a relative mouse movement, which works really good. See some screenshot of my experiment with RealVNC Android Viewer App in combination with our MobileVNC server and a HP t5000 Windows CE 4.1 thin client.

Samsung Galaxy Camera that comes with Android OS

A clever move by Samsung, after they lost over a billion$ to Apple in court, is to spread Google’s Open Source Android operating system to as many different devices as possible. One of these devices was published this week in form of a new Samsung Galaxy Camera. Samsung is the next big vendor after Nikon and Polaroid that publishes an Android based Camera device. Samsung Galaxy Camera offers a 16 magapixel cmos chip and 21x optical zoom. Samsung Galaxy Camera already ships with the recent Android version Jelly Bean 4.1.

Due to the fact that Android offers access to a large amount of software and apps, the Samsung Galaxy Camera offers a collection of software features, such as to allow users to organize their photos in folders directly on the camera.

GALAXY Camera Image7

GALAXY Camera Image3

My HTML5 Android Camera App: HTML5Cam

I just released a tiny and quite useful Android app that is able to open a HTTP server socket on your Android device, in order to serve you a simple HTML5 page that shows the actual smartphone camera output. This is a really simple possibility to get the camera output of your smartphone where ever you can open a browser. If you register a dyn dns name for your smartphones IP you can even refer to your smartphones camera worldwide. I wrote this tiny app in order to get the camera image of an old Android device that is sitting on top of my NXT Lego Mindstorms mobile robot! The HTML5Cam Android app is completely free, so try it for yourself from here.

Google launches MyTracks 2.0 for Android

My Tracks_android

Google recently launched MyTracks in version 2.0. MyTracks supports bikers and runners to keept track of theyr running activities and routes. It was also used by the Team HTC-Columbia during the Tour de France, in order to track the realtime route of the different bikers. MyTracks offers all necessary tour statistics and provides useful integration interfaces for Google Earth and other systems. You can use Google MyTracks as a free app on your Smartphone. See following screenshots taken from MyTracks app:

Similar apps for tracking outdoor activities are: Endomondo and Runtastic. I love Endomondo to tracking my mountain bike tours, where i usually take my daughter with me in a children’s bike seat. Following screenshots show some features of Endomondo, such as tracking tours and workouts, analytics, diagrams, community sharing and many more.

 

 

Endomondo Sports Tracker

runtastic

 

Google invests $5M In Virtual Currency Pocket Change

Pocket Change, a startup offering a virtual currency platform for Android games, has raised $5 million in a Series A round of funding by Google Venture.

The startup specifies on the creation of a common currency that works across all mobile Android platforms. It should be the currency that games use to sell theyr gimmicks and add-ons. Theyr mission is to build the world’s first universal virtual currency (i hope the value lasts longer than the Linden Dollar 😉 ). Several 100 games have already integrated this virtual currency, by which Pocket Change reaches around 2 M people.