Build and test iOS apps with AWS CodeCommit, AWS CodePipeline, and AWS Device Farm - AWS Prescriptive Guidance

Build and test iOS apps with AWS CodeCommit, AWS CodePipeline, and AWS Device Farm

Created by Abdullahi Olaoye (AWS)

Summary

Notice: AWS CodeCommit is no longer available to new customers. Existing customers of AWS CodeCommit can continue to use the service as normal. Learn more

This pattern outlines the steps for creating a continuous integration and continuous delivery (CI/CD) pipeline that uses AWS CodePipeline to build and test iOS applications on real devices on AWS. The pattern uses AWS CodeCommit to store the application code, the Jenkins open-source tool to build the iOS application, and AWS Device Farm to test the built application on real devices. These three phases are orchestrated together in a pipeline by using AWS CodePipeline.

This pattern is based on the post Building and testing iOS and iPadOS apps with AWS DevOps and mobile services on the AWS DevOps blog. For detailed instructions, see the blog post.

Prerequisites and limitations

Prerequisites 

  • An active AWS account

  • An Apple developer account

  • Build server (macOS)

  • Xcode version 11.3 (installed and set up on the build server)

  • AWS Command Line Interface (AWS CLI) installed and configured on the workstation

  • Basic knowledge of Git

Limitations 

  • The application build server must be running macOS.

  • The build server must have a public IP address, so CodePipeline can connect to it remotely to initiate builds.

Architecture

Source technology stack  

  • An on-premises iOS application build process that involves using a simulator or manual test on physical devices

Target technology stack  

  • An AWS CodeCommit repository for storing application source code

  • A Jenkins server for application builds using Xcode

  • An AWS Device Farm device pool for testing applications on real devices

Target architecture 

When a user commits changes to the source repository, the pipeline (AWS CodePipeline) fetches the code from the source repository, initiates a Jenkins build, and passes the application code to Jenkins. After the build, the pipeline retrieves the build artifact and starts an AWS Device Farm job to test the application against a device pool.

CI/CD pipeline uses AWS CodePipeline to build and test iOS applications on real devices.

Tools

  • AWS CodePipeline is a fully managed continuous delivery service that helps you automate your release pipelines for fast and reliable application and infrastructure updates. CodePipeline automates the build, test, and deploy phases of your release process every time there is a code change, based on the release model you define.

  • AWS CodeCommit is a fully managed source control service that hosts secure Git-based repositories. It makes it easy for teams to collaborate on code in a secure and highly scalable ecosystem. CodeCommit eliminates the need to operate your own source control system or worry about scaling its infrastructure.

  • AWS Device Farm is an application testing service that lets you improve the quality of your web and mobile apps by testing them across an extensive range of desktop browsers and real mobile devices, without having to provision and manage any testing infrastructure.

  • Jenkins is an open-source automation server that enables developers to build, test, and deploy their software.

Epics

TaskDescriptionSkills required

Install Jenkins on the build server that's running macOS.

Jenkins will be used for building the application, so you must first install it on the build server. To get detailed instructions for this and subsequent tasks, see the AWS blog post Building and testing iOS and iPadOS apps with AWS DevOps and mobile services and other resources in the Related resources section at the end of this pattern.

DevOps

Configure Jenkins.

Follow the on-screen instructions to configure Jenkins.

DevOps

Install the AWS CodePipeline plugin for Jenkins.

This plugin must be installed on the Jenkins server in order for Jenkins to interact with the AWS CodePipeline service.

DevOps

Create a Jenkins freestyle project.

In Jenkins, create a freestyle project. Configure the project to specify triggers and other build configuration options.

DevOps
TaskDescriptionSkills required

Create a Device Farm project.

Open the AWS Device Farm console. Create a project and a device pool for testing. For instructions, see the blog post.

Developer
TaskDescriptionSkills required

Create a CodeCommit repository.

Create a repository where the source code will be stored.

DevOps

Commit your application code to the repository.

Connect to the CodeCommit repository you created. Push the code from your local machine to the repository.

DevOps
TaskDescriptionSkills required

Create a pipeline in AWS CodePipeline.

Open the AWS CodePipeline console, and create a pipeline. The pipeline orchestrates all the phases of the CI/CD process. For instructions, see the AWS blog post Building and testing iOS and iPadOS apps with AWS DevOps and mobile services.

DevOps

Add a test stage to the pipeline.

To add a test stage and integrate it with AWS Device Farm, edit the pipeline.

DevOps

Initiate the pipeline.

To start the pipeline and the CI/CD process, choose Release change.

DevOps
TaskDescriptionSkills required

Review test results.

In the AWS Device Farm console, select the project you created, and review the results of the tests. The console will show the details of each test.

Developer

Related resources

Step-by-step instructions for this pattern

Configure AWS Device Farm

Configure the source repository

Configure the pipeline

Additional resources