Written By

Lee Flannery

 

Written By

Lee Flannery

Share

Subscribe

Stay up-to-date with OST blog posts.

May 11, 2017

Don’t wing it! Automating your mobile build process brings you speed, reliability, an audit trail, and one less thing to worry about.

I have no idea what I am doing.

Getting a mobile app from development to distribution is not hard, but it’s not intuitive. You don’t want to leave anything to chance when you do a release. The good news is that this process can be structured, repeatable, and reliable.

It me, before I learned the ways of DevOps...

You’re going to want it to be as easy as pushing a button. So, we’re going to automate your mobile builds. We’ll use some cloud-based platforms and services, some guidelines, and some discipline. Soon you’ll be back to coding and not worrying about the logistics of deploying your app.

The key to automating deployment is a CI/CD pipeline.

Explain CI/CD Automation?

CI/CD is continuous integration and continuous deployment.

Continuous integration means that code changes are merged into the main codebase on a frequent and regular basis. This ensures that any issues are caught early, conversations between developers are prompted, and there are no nasty surprises near the end of the project.

Getting finished features into release as soon as possible is part of any Agile process. For us, continuous deployment will get our release build into the production environment on a regular basis. Even if you choose to not make the app public immediately!


RELATED CONTENT
Xamarin Forms Tutorial: Customize Xamarin Forms With Open Source Code


I’m in. How do I start?

First, we’re going to get all the things you’d need to do this manually. Gather your Android signing keys, iOS certificates, and iOS provisioning profiles.

If that seems daunting to start with … then that’s the first issue you need to clear up. You should be storing these assets in a safe, encrypted system that’s accessible when you need it. KeyPass, 1Password, and Secret Server are a few options for securing your mobile app deployment credentials.

Have your secrets on hand and ready to go. One nice thing about this solution is that when we’re done, you won’t need to have these private keys and certificates floating around your development team. Once you set them up on your build server, you can grant anyone on your team the ability to deploy an app without giving them direct access to your certificates and signing keys.

Let’s light this candle.

Before we automate this, we need a build server. There are a lot of options we could use to set up our own internal build server. That involves having an in-house Mac (for iOS builds), maintaining operating systems, and keeping XCode up-to-date.

We’re keeping it simple so for this exercise, so we’re going to use a solid “platform-as-a-service” build server: Bitrise.

Your build server pulls all of your code and tools together. Bitrise supports both iOS and Android. Bitrise can build for a wide spectrum of coding architectures, from native Java, Objective C and Swift, to Xamarin’s C# dual-platform solution, to Cordova’s HTML/Javascript option.


RELATED CONTENT
A Developer’s Review of Popular Mobile App Frameworks


It’s an understatement to say that delivering mobile apps can be quite a hassle.

As an aside: keep an eye on Microsoft’s Visual Studio Mobile Center, which is currently in preview mode and promises to have all the features of Bitrise. But Bitrise is here now, and will serve our purposes well.

Bitrise allows you to build a series of steps to do the work of building your app. You can create a step to automatically increment your build number (a lot better than relying on a person to do it). You will set up build and signing steps. You’ll set up an archive step so that every time you run a build you will have a copy of the output. You’ll set up steps to run your unit tests and your UI tests. And you’ll set up steps to ultimately deploy your app to wherever you need it to be.

Bitrise automated workflows are created from steps and other smaller workflows.

You can make different workflows out of these component steps. These workflows can be scheduled, triggered by an event, or run manually.

Now that you have your workflows and steps, you can create your DevOps automation empire. Some of the useful workflows you can set up are:

  • Scheduling nightly builds form your main branch
  • Scheduling long-running UI tests nightly
  • Triggering a build and your unit tests to run on every push to your main branch
  • You can even create a workflow to build and sign your app for production and push it into the proper store.

I can automate my app’s push into the app stores?

Yep. You can do it before you’re ready for production and you should.

Both iOS and Android allow you to land your app in it’s home on the store well before you intend to make your app public. You should do this as soon as your app’s architecture is reasonably built out. Apple’s beta program is called TestFlight, and Google’s similar program is in the Google Play Store under Google Play Store Beta.

Why? Especially on iOS, you may find some issues with your app. Are you using the camera API or maps API without asking the user for permission? Are you using a deprecated control? Getting your “slot” in the store early will reveal these issues and allow you to fix them early in the development process and avoid an unpleasant surprise in the week you think you’re going to ship.

Also each store has a minimum set of marketing copy, images, and other metadata required for your app to be in the store. Getting your app into these beta programs requires you to address this early. If you are going to need content generated by your design team, marketing team, or run through your legal department, this step will let you know.

And … apps in TestFlight or Google Play Store Beta can be promoted directly to production and published in the store. You are literally pushing the exact same build that your beta users have tested into production, which eliminates any potential issues introduced by a new build.

Life is good again.

Once you’re done setting this up, you’re just pushing buttons or setting a schedule to build your app, run your tests, and deploy your app. Your workflows can be saved off into your repo as YAML files for history and source control of your DevOps efforts. You’ll be able to build and sign your apps correctly every time effortlessly. You’ll be diligently running your tests. And you’ll have your store environments set up and vetted well before it’s time to ship your app.

The sun always rises.

It’s an understatement to say that delivering mobile apps can be quite a hassle. Automating and honing your build and delivery pipeline will let you hurdle many of the most common issues you’ll face. You’ll be spending less time figuring out how to build, sign, and deliver your app, and more time adding features, fixing defects, and engaging your users.

Share

Subscribe

Stay up-to-date with OST blog posts.

About the Author

Lee is a software developer with a beard who specializes in mobile app development. Lee is a Xamarin certified developer with experience in native mobile platforms, mobile devops, and integrating IoT and Bluetooth devices with mobile apps. He started developing professionally in 2000 and joined OST in 2013. Lee brings Agile methods to his solo dev work and to his work as a teammate in large enterprise organizations.

Lee focuses on bringing sanity and order to software development through humor, community building, and his passion for vetting new technology and processes. He can be found many places online including his Twitter account at https://www.twitter.com/@somethingblewup/, and his podcast Release Mode at https://www.releasemode.com/.

Lee enjoys comic book collecting with his 2 sons, traveling and exploring with his wife, and the company of his 2 Siamese cats.