Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Migrating your mobile CI/CD environment to a scalable cloud solution using CircleCI

Migrating your mobile CI/CD environment to a scalable cloud solution using CircleCI

Tadashi Nemoto

October 12, 2023
Tweet

More Decks by Tadashi Nemoto

Other Decks in Programming

Transcript

  1. 1 Migrating your mobile CI/CD environment to a scalable cloud

    solution using CircleCI Tadashi Nemoto CircleCI Senior Solutions Engineer
  2. 2 About this workshop Interested in moving your mobile CI/CD

    environment to cloud, but not sure where to start? Interested in speeding up builds and tests for mobile development? CircleCI has you covered! In this workshop, we’ll cover the basics of how mobile CI/CD projects work on CircleCI, how to migrate from on-prem to the cloud and discuss some of the pipeline optimizations you can use to increase your build speed and efficiency. Who will benefit from this workshop: • DevOps engineers curious about mobile CI/CD • Mobile developers interested in speeding up their builds and tests
  3. 3 Agenda • Importance and Challenges of CI/CD in Mobile

    Development • CircleCI Intro & key features for mobile development • CircleCI Mobile Demo • How to migrate mobile projects to CircleCI • Summary / Q&A
  4. 6 • Can update software with low cost • Retention

    rate is important for success • Continuous quality improvements for various devices Important to provide and improve features quickly and continuously CI/CD(Continuous Integration/Continuous Delivery) is essential
  5. 7 Challenges of Mobile CI/CD • Managing build fleet (especially

    Mac for iOS builds) ◦ Requires machines with high specs ◦ Provision and maintain Mac hardware ▪ Buy your own, or use cloud providers with limitations ◦ Regularly updating macOS and Xcode CI/CD is not yet implemented Managing on-prem environments(e.g Jenkins)
  6. 8 Problems of managing on-prem mobile CI/CD environment • High

    maintenance cost • Unable to scale development • Low developer productivity ◦ Slow build/test speed ◦ Unstable build/test ◦ Poor debugging experience • Unsuitable for remote development https://devblogs.microsoft.com/devops/cloud-hosted-mac-agents-for-ci-cd-pipelines/
  7. 10 Creation Orchestration Operations Collaborate Source Control Where CircleCI Sits

    in the Toolchain Deliver Build • Test • Deliver・Release Run Monitor • Operate SHIP TO PRODUCTION CODE COMMIT
  8. 12 CircleCI key features for mobile projects Resource Classes Choose

    from a vast fleet of executor types: Docker, Linux VM, macOS. All offer a range of CPUs, GPUs, memory, and images to customize each jobs Test splitting Shorten the feedback loop by automatically splitting your tests across parallel instances of the same job SSH debugging Securely access any job on CircleCI to debug builds and tests in real-time iOS Simulators Android Emulators Tests can run on them, including Xcode UITest(XCUITest), Espresso, and a snapshot test Orb(Integrations) Reusable snippets of code that help automate repeated process and speed up project setup Insights dashboard Insights allow team to improve engineering productivity
  9. 14 CircleCI provides powerful and constantly updated (especially macOS and

    Xcode) Mac environment • CircleCI provides Apple Silicon Mac(M1 Mac) from 2023 Up to 2x faster build speed than Intel Mac • Not guaranteed in SLA, but we aim to support a new Xcode within a couple of days. ◦ https://circleci.com/docs/xcode-policy/ 1. Powerful resource classes for mobile CI/CD(Mac) Intel Mac M1(Apple Silicon) Mac
  10. 15 2. iOS Simulators / Android Emulators • The iOS

    simulator can run on a macOS VM • The x86 Android emulator can run on an Android VM • Tests can run on iOS Simulators / Android emulators, including Xcode UITest (XCUITest), Espresso, and snapshot tests • Booting and testing can be conducted in a clean environment every time
  11. 17 4. Test Splitting “Any time a developer spends waiting

    for tests to run is time not spent writing the next piece of code, not to mention the cost of waiting around and losing context on what they’re working on. Fast feedback is everything.” - Rob Zuber One of the easiest ways to speed up builds on CircleCI is with test splitting. Particularly, splitting tests by timing data.The CircleCI test splitting mechanism takes in a list of tests and splits those tests across the number of nodes defined by the parallelism key.
  12. 18 5. Debugging with SSH The best way to troubleshoot

    problems is to securely debug problems within the job environment - while it’s running. Without SSH access to the build environment, a developer has to try to replicate the CI/CD environment in their dev environment in order to accurately identify the issue, then attempt to resolve it using only application, stack trace, and system logs. These types of situations are a huge waste of time for developers and SRE teams.
  13. 19 6. Insights / Test Insights Dashboard Pipeline Optimization: •

    All workflow runs • Success rate • Duration • Credit consumption Test Insights: • Performance Summary • Top 10 Most Failed Tests • Top 10 Slowest Tests
  14. 20 CircleCI key features for mobile projects Resource Classes Choose

    from a vast fleet of executor types: Docker, Linux VM, macOS. All offer a range of CPUs, GPUs, memory, and images to customize each jobs Test splitting Shorten the feedback loop by automatically splitting your tests across parallel instances of the same job SSH debugging Securely access any job on CircleCI to debug builds and tests in real-time iOS Simulators Android Emulators Tests can run on them, including Xcode UITest(XCUITest), Espresso, and a snapshot test Orb(Integrations) Reusable snippets of code that help automate repeated process and speed up project setup Insights dashboard Insights allow team to improve engineering productivity
  15. 22 Android demonstration • https://github.com/tadashi0713/circleci-demo-android • Resource classes (Docker and

    Linux VM) • Orbs ◦ Android Orb (Gradle cache) ◦ Ruby Orb (fastlane installation) • Espresso test running on the Android emulator & Test splitting • Distributed on Firebase App Distribution • Insights dashboards and SSH debugging
  16. 23 iOS demonstration • https://github.com/tadashi0713/circleci-demo-ios • macOS resource classes (M1

    Mac VM) • Orbs ◦ Ruby Orb (fastlane installation) ◦ macOS Orb to preboot the iOS simulator • XCUITest by using the iOS simulator & Test splitting • Distributed on the fastlane match & Firebase App Distribution • Insights dashboards and SSH debugging
  17. 24 Flutter / React Native • Flutter ◦ https://github.com/tadashi0713/circleci_flutter_demo ◦

    Flutter Orb (SDK installation and cache) ◦ UI tests, fastlane match, and distributed on Firebase App Distribution • React Native ◦ https://github.com/tadashi0713/circleci-reactnative-detox-demo ◦ React Native Orb (installation and cache) ◦ UI test, distributed on Firebase App Distribution
  18. 26 CircleCI and Fastlane • We recommend using fastlane to

    simplify your mobile development pipeline • Fastlane supports running tests, taking screenshots, iOS code signing (fastlane match), builds, distributing debug/beta versions, and releasing apps on App Store/Play Store • https://docs.fastlane.tools/best-practices/continuous- integration/circle-ci/
  19. 27 iOS Code Signing on CircleCI • We recommend using

    fastlane match for configuring iOS code signing on CircleCI. • https://circleci.com/docs/ja/2.0/ios-codesigning/ https://qiita.com/kotarella1110/items/840af2cf80aaea1fb035
  20. 28 Mobile CI/CD Migration Strategies • Start small! • Don’t

    try to build the perfect pipeline from the beginning – aim for “good enough” • Schedule time for retrospectives and continuous learning • Migrate pipeline steps in the following order: ◦ Build & Unit tests ◦ Integration tests ◦ Debug distribution ◦ Release distribution
  21. 29

  22. 30

  23. 31

  24. 34 Summary • CI/CD is essential for continuous development of

    mobile development with high release frequency • Mobile CI/CD tends to be a challenge in terms of build machines to run(especially Mac) • CircleCI provides maintenance-free and on-demand machines required for mobile CI/CD, including Mac • CircleCI provides strong features to increase your build speed and efficiency of your mobile CI/CD
  25. 35 CircleCI key features for mobile projects Resource Classes Choose

    from a vast fleet of executor types: Docker, Linux VM, macOS. All offer a range of CPUs, GPUs, memory, and images to customize each jobs Test splitting Shorten the feedback loop by automatically splitting your tests across parallel instances of the same job SSH debugging Securely access any job on CircleCI to debug builds and tests in real-time iOS Simulators Android Emulators Tests can run on them, including Xcode UITest(XCUITest), Espresso, and a snapshot test Orb(Integrations) Reusable snippets of code that help automate repeated process and speed up project setup Insights dashboard Insights allow team to improve engineering productivity