The Importance of Continuous Integration & Release Automation
Improve Product Quality with Automated Codebase Operations
The challenge of modern software development is knowing how to rapidly react to business demands and address product owners’ feedback to deliver relevant and high-quality products. The sooner an improvement is incorporated by the development team and verified, the better the outcome. This is especially valuable with instant verification processes that provide an immediate response to the codebase change, minimizing the number of manual steps during release preparation.
Along with the other fundamental DevOps best practices, which are also covered by this 12-factor mobile app blog series, continuous integration (CI) and continuous delivery (CD) operations help to significantly decrease operational team overhead through the mobile app development and distribution process. Automation ensures the distributable software complies to the code quality standards before involving manual testing:
- Continuous integration is used to assemble the mobile app's build artifact based on the recent codebase changes, pushed into a maintained repo branch, and ensures the resulting branch state is characterized as "stable" (i.e., conforms to the product quality objectives).
- Continuous delivery is implemented to automatically roll out the selected build artifact as an installable app on a target environment (via TestFlight, for example).
- Continuous deployment extends continuous delivery operations toward fully automatic publishing of the chosen app version for the production use. This is not applicable for public apps due to the need to manually submit a release candidate for the formal review, but it's relevant to enterprise apps without the capability to publish the release automatically with a corporate app management solution.
Continuous Integration leverages special tools to fetch the codebase from a development repository code branch by a trigger. As soon as the code snapshot is retrieved, automation performs a sequence of defined actions to produce a build artifact and optionally does verification against quality gates.
The codebase change is then asserted and treated as healthily integrated if the pipeline sequence passes successfully.
A proper 12-factor mobile app CI pipeline sequence should be planned ahead to define:
- Build host environment: A so-called "agent" or "runner," either dedicated or virtual/containerized machine in a cloud that must include all the required dependencies (target OS, framework SDKs, app's external libraries, verification tools). In some cases, the use of Linux or a dedicated self-hosted build agent may be beneficial for cost savings.
- Pipeline trigger: Either a git push into a specific repo branch or creating a pull request. For bigger projects, avoid adding too many triggers to keep the pipeline outputs meaningful, such as verifying protected branches only.
- Pulling: The codebase from a specified repository branch on a trigger. For large repositories, consider incremental (shallow) cloning to prevent downloading the whole repo work tree.
- Build configuration: Support by the codebase to produce a specific app bundle and custom verification on the purpose, such as ad-hoc distribution for manual testing or performance profiling, and live-ready distribution for automated testing on real devices, beta-testing by users or production use.
- Pre-build steps: Like code generation, automatic formatting or assets bundling.
- Post-build quality gate: For codebase verification.
A complying 12-factor mobile app quality gate should include the following automatic verification steps to ensure the build is ready for further manual functional testing:
- Checking the source code style and performing static analysis against a set of rules, with appropriate linter and static analysis tools.
- Unit tests execution to ensure the code change conforms to the expectations.
A comprehensive check list can be incorporated with these additional factors:
- Collecting the code coverage metric and comparing with a minimum coverage objective.
- Gathering code quality metrics, such as cyclomatic complexity or duplication, and comparing with the baseline objectives.
- Running a chronological code quality analysis to recognize trends, comparing with previous codebase metric snapshots.
- Engaging automatic integration tests, executing a dedicated API client module against the remote endpoints.
- Opt-in end-to-end UI tests orchestrated by device cloud services with report generation.
Continuous Delivery & Continuous Deployment
Manual release preparation can be cumbersome and error-prone, especially with customized workflows for different targets. To secure app distribution operations, the delivery and deployment pipelines should leverage CI to prepare the app bundles but finalize them separately, depending on the purpose.
Some examples include:
- Public (B2C/B2B) releases signed with a production certificate to Apple App Store Connect and Google Play Console (for further review process).
- Beta app builds signed with either a production or ad-hoc certificates and revise Apple and Google documentation for available options.
- QA ad-hoc app builds for a registered list of devices, to services like App Center, Firebase App Distribution, TestFlight.
- In-house (B2E) releases and builds signed with an enterprise certificate to a company's distribution platform (MDM or UEM service).
Local Automations for Faster Verification
Sophisticated 12-factor app's CI/CD operations rely on proper code repository organization, branching and protection conventions. Better results can be achieved with shorter verification cycles to a developer's code changes, ideally inline during coding. Consider setting up code style analysis in real time. Preparation of the workspace build scripts for seamless building, analyzing, checking unit tests, and even running integration and end-to-end tests locally would contribute to faster quality gate checks, even before CI/CD resource involvement.
By prioritizing continuous integration and delivery, automated codebase operations result in seamless integration of changes and improved product quality. This facilitates faster development times and better organization and implementation around product releases.