Build on Apple silicon with M1 support for CI/CD pipelines
Senior Product Manager
Software Engineer
Apple developers across the globe leverage CircleCI’s vast selection of macOS resources to swiftly build, test, and deploy software. To help teams bring their software delivery to the next level with record-breaking build speed, CircleCI now offers M1 compute in both medium (4 vCPUs, 6GB RAM) and large (8 vCPUs, 12GB RAM) resource classes. These additions meet the burgeoning demand for convenient, cloud-hosted Apple silicon support and helps development teams stay up to date with Apple’s hardware innovation.
As a best-in-class CI/CD platform, CircleCI is committed to equipping the Apple community with top-shelf tools that will help ship products to end users faster. Read on to learn more about the details of M1 on CircleCI and how building on M1 propels projects into the future of Apple development.
now available
Accelerate iOS build pipelines with M1
In 2020, Apple unveiled a suite of Mac laptops with a special surprise inside— an M1 chip built for optimal efficiency. Since its debut, Apple silicon has lived up to its promise to deliver superior speed and performance.
The efficiency of M1 is rooted in its signature “System on a Chip” which unifies various components — including the CPU, GPU, RAM, and Secure Enclave — into one processor. The streamlined memory architecture of M1 allows the processor components to leverage a central data pool, eliminating the time used to copy data between each component. With this leap forward in efficiency, it is safe to say that the future is silicon-based.
Benefits of M1 for iOS developers
More convenient end-to-end testing, including GPU tests: Automated testing is an integral part of continuous integration/continuous delivery pipelines as it is crucial to be able to quickly and confidently build and deploy code that works. One of the biggest challenges when testing macOS and iOS platforms is graphics processing unit (GPU) testing for GPU-intensive applications like gaming and virtual reality apps.
Previously, the only way to effectively run automated GPU tests on the macOS platform was to use a dedicated host. Some developers work around this limitation by testing on a local GPU device, but performing automated GPU tests in the CI pipeline allows for more frequent, consistent tests that provide a better sense of the end user experience.
CircleCI’s M1 resource includes hardware acceleration to transfer tasks typically done by software running on the CPU to the GPU for faster processing times. For example, a 3D rendering task that may appear choppy when processed by the CPU will look fluid when performed by the GPU. This makes for fast, effective, and smooth GPU tests within the pipeline that provide rapid feedback about the visual effects within applications and help minimize breaking changes before shipping updates.
Increased build speed for a better product experience: When it comes to providing a quality product experience, speed is the name of the game. To build loyalty and trust, engineering teams must deliver enhancements and bug fixes to customers in a matter of minutes. In benchmark testing, M1 set a new standard for build velocity by boosting macOS job speed by 2x. This is particularly useful for iOS teams as it expedites the App Store review process and helps get apps approved and published quicker. The less time spent submitting, and re-submitting, to the App Store, the more time can be invested in writing code that matters.
How M1 compute improves build speed
Below is an example of a job that pulls down a clone of a large repo (~4GB), then saves and retrieves the cache.
On Intel hardware, this job took nearly 24 minutes. The steps for cloning the repo and saving the cache accounted for the majority of the total build time. Below is an example of the same job running on M1 resources.
On the M1 large resource class, the same job finished in under 7 minutes, approximately 25% of the time required to run on Intel hardware! Please note that performance results will vary depending on the workflow.
How to use the M1 resource class in your CircleCI pipelines
Building with M1 requires a simple update to the configuration file on CircleCI. Below is an example of config for reference:
# .circleci/config.yml
version: 2.1
jobs: # a basic unit of work in a run
build-and-test: # your job name
macos:
xcode: 14.2.0 # indicate your selected version of Xcode
resource_class: macos.m1.large.gen1
steps: # a series of commands to run
- checkout # pull down code from your VCS
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: output
- store_test_results:
path: output/scan
workflows:
build-test:
jobs:
- build-and-test
This config uses the resource_class
key to specify that the build-and-test
job should use an M1 large instance of the macos
executor. To use M1 medium instead, you can change the resource_class
value to macos.m1.medium.gen1
. Note that you can also determine which version of Xcode to use in your build.
What does building with M1 mean for my iOS pipelines?
Apple’s strong investment in shifting from Intel-based to Arm-based M1 chips indicates that eventually all Apple development will run on Apple silicon. Teams building for Mac on CircleCI can stay ahead of the curve by building with M1 in their pipelines. Below, we’ll answer some common questions we’ve heard from the Mac community.
Can I build for Intel on M1 compute? Testing Intel apps on M1 can be easily accomplished by adding a step to install Rosetta, a common software tool that enables an M1 Mac to use apps built for an Intel Mac. For an example on doing this, you can reference this PR for our macOS orb.
What will M1 compute cost on CircleCI? You can find pricing information for M1 medium and large, as well as all of CircleCI’s other macOS resources, on our Resource Classes page.
Conclusion
The next generation of building and testing Apple applications on CircleCI is here. From streamlining end-to-end testing to accelerating time to market, M1 can help engineering teams everywhere ship quality applications and scale developer operations with maximum efficiency.
M1 is currently available on the Performance and Scale plans. Learn more about CircleCI’s full macOS support in our documentation.