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

Continuous Integration in a monorepo

Continuous Integration in a monorepo

Slides from presentation given alongside Max Friedrich at CocoaHeads Hamburg May 2017 meet up.

Renzo Crisóstomo

May 04, 2017
Tweet

More Decks by Renzo Crisóstomo

Other Decks in Programming

Transcript

  1. > First commit: Thu Oct 28 11:52:30 2010 > Objective-C:

    228001 LOC, Swift : 16215 LOC > Internal libs: 20. External libs: 40 > Over 30 contributors > Over 50 commits per day merged on master > Over 20 builds per day
  2. . !"" Rakefile !"" Gemfile !"" XNGABTest # !"" .git

    # !"" Rakefile # !"" Gemfile ... # $"" Sources !"" XNGAdvertising !"" XNGComponents ... $"" iphone-app !"" .git !"" Rakefile !"" Gemfile ... $"" Sources
  3. > Checkout branch and install deps: 00:04:38 > Checkout out

    a different branch: 00:04:15 > Indexing: 00:04:05
  4. MONOREPO > Workspace with multiple projects/targets > Shared xcconfig files

    > CocoaPods/Rome to build third party dependencies
  5. . !"" XING.xcworkspace !"" apps # !"" XING # $""

    examples !"" libraries # !"" XNGABTest # !"" XNGAdvertising ... # $"" XNGUnitTestHelper !"" third_party_dependencies !"" tooling $"" vendored_dependencies
  6. > bootstrap (only once*): 00:02:12 > checkout branches: instantly! >

    indexing (only once): 00:03:44 > indexing (delta): 00:00:25
  7. > 2 Mac Pros (2013) > We use Jenkins >

    16 VM running macOS on top of VMware host > 6 VM connected through SSH (headless): 1 executor > 10 VM connected through JNLP: 1 executor > Open source: xing/XNGMacBuildNodeSetup
  8. MAKING CI WORK ON THE MONOREPO > Be smart about

    when to test > Be smart about what to test > Parallelize the work
  9. STEP BY STEP 1. Comment Triggers 2. GitHub Pull Request

    Builder (Jenkins plugin) 3. Pandan 4. Jenkins Pipelines 5. Danger
  10. > Swift build & test takes hours > We have

    TODO: N test targets, half are tested on 3 simulators > Building and testing everything takes an hour on one machine
  11. MAKING CI WORK ON THE MONOREPO > Be smart about

    when to test !"#$% > Be smart about what to test > Parallelize the work
  12. Hack week project! > We stopped using CocoaPods for internal

    libraries > Dependencies stored in the Xcode project > CLI tool to get dependency graph from Xcode workspace > Uses xcodeproj gem
  13. Output all targets that depend on a target: $ pandan

    query --reverse XNGComponents XNGJobs XNGEvents ...
  14. MAKING CI WORK ON THE MONOREPO > Be smart about

    when to test !"#$% > Be smart about what to test ✅ > Parallelize the work
  15. > See at first glance what failed > Small speedups

    with parallel steps > Easier to maintain Jenkins config (Jenkinsfile in SCM)
  16. MAKING CI WORK ON THE MONOREPO > Be smart about

    when to test !"#$% > Be smart about what to test ✅ > Parallelize the work ✅
  17. WHAT WE NEED TO IMPROVE > Our CI is not

    continuous anymore :( > Build time is still high, keep derived data? > Get better at analyzing our new numbers