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

    View Slide

  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

    View Slide

  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

    View Slide

  4. 4
    Importance and Challenges of
    CI/CD in Mobile Development

    View Slide

  5. 5
    https://www.prnewswire.com/news-releases/mobile-apps-market-size-to-grow-by-usd-653-91-billion--technavio-301511786.html

    View Slide

  6. 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

    View Slide

  7. 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)

    View Slide

  8. 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/

    View Slide

  9. 9
    CircleCI intro & key features for
    mobile development

    View Slide

  10. 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

    View Slide

  11. 11
    CircleCI case studies for mobile projects
    https://circleci.com/customers

    View Slide

  12. 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

    View Slide

  13. 13
    1. Powerful resource classes for mobile CI/CD
    https://circleci.com/ja/product/features/resource-classes/
    Maintenance-free and on-demand
    machines are available

    View Slide

  14. 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

    View Slide

  15. 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

    View Slide

  16. 16
    3. CircleCI Orb(Integrations) for mobile projects
    https://circleci.com/developer/orbs

    View Slide

  17. 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.

    View Slide

  18. 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.

    View Slide

  19. 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

    View Slide

  20. 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

    View Slide

  21. 21
    Demo

    View Slide

  22. 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

    View Slide

  23. 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

    View Slide

  24. 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

    View Slide

  25. 25
    How to migrate mobile projects
    to CircleCI

    View Slide

  26. 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/

    View Slide

  27. 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

    View Slide

  28. 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

    View Slide

  29. 29

    View Slide

  30. 30

    View Slide

  31. 31

    View Slide

  32. 32
    CircleCI Premium Support
    https://circleci.com/support/plans/

    View Slide

  33. 33
    Summary / Q&A

    View Slide

  34. 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

    View Slide

  35. 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

    View Slide

  36. 36
    Thank you!!

    View Slide