Reduce AppCenter iOS build time by 50%

Radu Iamandi
salt&pepper
Published in
2 min readJun 7, 2021

--

Photo by Artem Maltsev on Unsplash

AppCenter is a CI/CD platform for building, testing, releasing and monitoring mobile apps. One thing that makes it attractive is its support for React Native.

One of the main issues that React Native developers encounter when using AppCenter for their apps is the HUGE iOS build time. After some googling, I found an answer to my question and the culprit: Flipper.

Flipper is a platform developed by Facebook and is a great tool in React Native debugging. The problem is that it is also added in the production build. Being hefty, Flipper can add a lot of time to a build.

Let’s fix this!

In order to avoid building Flipper alongside our app, we have to detect when the build is done by AppCenter first. One way to do this is using AppCenter’s environment variable APPCENTER_BUILD_ID. It is easily accessible from our Podfile.

IS_CI = ENV['APPCENTER_BUILD_ID']

Now, we have to avoid building Flipper.

if not IS_CI
use_flipper! ( { ... } )
end
...post_install do |installer|
if not IS_CI
use_flipper!
end
end

Job done! Commit, push and try a build. For my side, the build time was reduced from 50 minutes to under 25. That’s more than 50%!

2 builds a day = 50+ minutes of time saved. That’s over 200 hours a year.

It’s hard to believe that a few lines of code can save so much time. I was shocked too!

Time flies, but it’s okay because you’re a native pilot.

TL;DR;

# Detect AppCenter CI build
IS_CI = ENV['APPCENTER_BUILD_ID']
# ...if not IS_CI
use_flipper! ( { ... } )
end
# ...post_install do |installer|
if not IS_CI
use_flipper!
end
end

--

--