$30 off During Our Annual Pro Sale. View Details »

The White Glove Treatment: Polishing Your iOS Build with Jenkins

The White Glove Treatment: Polishing Your iOS Build with Jenkins

We use continuous integration and delivery systems to help us build apps all the time. Our pull requests trigger builds that we can test, merging them triggers other builds that we can deploy, and so on. What about all of the other tedious tasks involved in development? This talk will cover using Jenkins, fastlane, and other tools as a system to automatically update an iOS app's dependencies—whether you use CocoaPods, Carthage, or the Swift Package Manager—provide inline feedback on pull requests, and manage tedious distribution work. By the end, you'll have tools at your disposal to let Jenkins do the tedious part of app development, letting you take care of what's actually important.

Jeff Kelley

August 22, 2019
Tweet

More Decks by Jeff Kelley

Other Decks in Technology

Transcript

  1. The White Glove Treatment
    Polishing Your iOS Build with Jenkins
    Jeff Kelley (@SlaunchaMan)
    Abstractions II, August 22nd, 2019

    View Slide

  2. The White Glove Treatment
    Polishing Your iOS Build with Jenkins
    Jeff Kelley |

    View Slide

  3. The White Glove Treatment
    Polishing Your iOS Build with Jenkins Continuous
    Integration
    Jeff Kelley |

    View Slide

  4. The App Development Process
    1. Ideation/Design
    2. Build
    3. Test
    4. Deploy
    Jeff Kelley |

    View Slide

  5. Agenda
    Automate Repetitive Tasks
    Manage Long-Running Tasks
    Serve as the Authoritative Build Server
    Control Access to Administrative Actions
    Jenkins image by the Jenkins Project. CC BY-SA 3.0

    View Slide

  6. Agenda
    Automate Repetitive Tasks
    Manage Long-Running Tasks
    Serve as the Authoritative Build Server
    Control Access to Administrative Actions
    Jenkins image by the Jenkins Project. CC BY-SA 3.0

    View Slide

  7. Automate Repetitive Tasks
    PR Builds
    • Probably the most-run Jenkins job
    • Build the code, run the test suite, deploy build for QA
    • Can have multiple checks that all must pass to merge
    Jeff Kelley |

    View Slide

  8. Automate Repetitive Tasks
    PR Builds
    • Probably the most-run Jenkins job
    • Build the code, run the test suite, deploy build for QA
    • Can have multiple checks that all must pass to merge
    Jeff Kelley |

    View Slide

  9. Automate Repetitive Tasks
    Pushing New Versions
    • Triggered on a push to master for projects that build libraries
    • Automatically push to CocoaPods, tag Git release, tweet about it, etc.
    Jeff Kelley |

    View Slide

  10. Automate Repetitive Tasks
    Dependency Updates
    Jeff Kelley |

    View Slide

  11. Automate Repetitive Tasks
    Dependency Updates
    • Stay on top of important security updates
    • Usually only a handful of updates when run daily
    • Prevents large sets of updates when projects get around to it
    Jeff Kelley |

    View Slide

  12. Agenda
    Automate Repetitive Tasks
    Manage Long-Running Tasks
    Serve as the Authoritative Build Server
    Control Access to Administrative Actions
    Jenkins image by the Jenkins Project. CC BY-SA 3.0

    View Slide

  13. Manage Long-Running
    Tasks
    UI Testing
    UI tests are:
    • Great for regression testing
    • Easy to write with Xcode
    • Extremely fragile
    • Slow
    Jeff Kelley |

    View Slide

  14. Manage Long-Running Tasks
    Mutation Testing1
    • Changes your code and sees if your tests fail
    • Runs your test suite after each change
    • Can take many hours
    1 For mutation testing in Swift, use Sean Olszewski’s Muter.
    Jeff Kelley |

    View Slide

  15. Manage Long-Running Tasks
    Handling Multiple Simulated Devices
    Jeff Kelley |

    View Slide

  16. Agenda
    Automate Repetitive Tasks
    Manage Long-Running Tasks
    Serve as the Authoritative Build Server
    Control Access to Administrative Actions
    Jenkins image by the Jenkins Project. CC BY-SA 3.0

    View Slide

  17. Serve as the Authoritative Build Server
    When it’s time to ship, your project has some output
    • iOS: .ipa file or direct App Store submission
    • Android: .apk file or direct Google Play submission
    • Web: Docker images
    How do you know what’s in those builds?
    Jeff Kelley |

    View Slide

  18. Serve as the Authoritative Build Server
    fastlane
    Google’s fastlane tool simplifies iOS workflows
    • Build your app and run your tests
    • Submit to Crashlytics, TestFlight, or the App Store
    • Generate screenshots across every combination of device size/language
    Jeff Kelley |

    View Slide

  19. Serve as the Authoritative Build Server
    Recently Apple made a change that the required the main Apple ID on your Apple
    Developer to use two-factor authentication.2 Many people complained about Jenkins
    breaking due to this. You should not ever store the password to this account on Jenkins
    or any other CI system. Someone with access to your Jenkins instance could simply add
    this to a build script:
    echo ${JENKINS_APPLE_ID_USERNAME}
    echo ${JENKINS_APPLE_ID_PASSWORD}
    2 Apple uses their own proprietary 2FA solution, so many common products couldn’t solve this problem.
    Jeff Kelley |

    View Slide

  20. Agenda
    Automate Repetitive Tasks
    Manage Long-Running Tasks
    Serve as the Authoritative Build Server
    Control Access to Administrative Actions
    Jenkins image by the Jenkins Project. CC BY-SA 3.0

    View Slide

  21. Control Access to Administrative Actions
    Taken from apple/swift#26705

    View Slide

  22. Thank You!
    Fastlane Template:
    https://github.com/detroit-labs/fastlane-template
    Contact info:
    Jeff Kelley
    Slides: https://speakerdeck.com/SlaunchaMan
    Twitter: @SlaunchaMan
    E-Mail: jeff@detroitlabs.com

    View Slide