slow build time, it takes almost 60 minutes to complete the Git Actions Workflow
pnaa opened this issue · 5 comments
Hello everyone,
Even with some caching on yarn modules and pod files, it still takes too long to build a react-native ios version.
Any thoughts?
Thanks in advance.
Same issue here, the iOS build takes 40+ minutes.
Even the JS bundle file takes over 10 minutes to be generated when building the app for iOS:
2022-12-13T07:08:52.6640470Z warning: the transform cache was reset.
2022-12-13T07:08:52.6640800Z Welcome to Metro!
2022-12-13T07:08:52.6641240Z Fast - Scalable - Integrated
2022-12-13T07:08:52.6641410Z
2022-12-13T07:08:52.6641430Z
2022-12-13T07:20:06.0772930Z info Writing bundle output to:
2022-12-13T07:20:06.1211350Z info Done writing bundle output
When building the same app for Android (using Github actions), the bundler only takes less than a minute to run:
2022-12-12T13:52:57.3752818Z warning: the transform cache was reset.
2022-12-12T13:52:57.4753566Z Welcome to Metro!
2022-12-12T13:52:57.4754159Z Fast - Scalable - Integrated
2022-12-12T13:52:57.4754338Z
2022-12-12T13:52:57.4754345Z
2022-12-12T13:53:51.2753467Z info Writing bundle output to:
2022-12-12T13:53:51.2754642Z info Writing sourcemap output to:
2022-12-12T13:53:51.3755438Z info Done writing bundle output
My android version is fairly quick to build, it takes less than 10 min to run the whole workflow.
Yeah, I'm in a similar boat. Android finishes fast whereas this build action alone takes close to 30 minutes.
- Use the
mikehardy/buildcache-action
to cache parts of your build. - Use
actions/cache
to cache CocoaPods.
As @paulschreiber mentioned you should use mikehardy/buildcache-action
for iOS build time reduction. The problem is that you can not override compiler on command line, but you can allow buildcache using everywhere.
To do that just add the next code to your Podfile:
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["CC"] = "clang"
config.build_settings["LD"] = "clang"
config.build_settings["CXX"] = "clang++"
config.build_settings["LDPLUSPLUS"] = "clang++"
end
end
NOTE: if you are using XCode 15 you may get the no template named 'unary_function' in namespace 'std';'
error. To get rid of it you need to force C++ unary_function
and binary_function
enabling. To do that add an additional config.build_settings
line:
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']