How can I use cache push/pull for react native apps?

react-native
#1

Hey all,

I would like to ask how can I use cache push/pull for react native apps? Is $BITRISE_CACHE_DIR enough? or should I add more for yarn, android, and ios stuff? Because builds take almost 40mins which is crazy right now :slight_smile:

yarn takes 4mins
xcode-archive takes 17mins
android build takes 11mins
and off course we have some other steps as well

1 Like

#2

Hi @heyilker!

So, the caching structure isn’t specific to any platform or frameworks :slight_smile: Even for React Native you could have multiple and different dependency managers. We feel like you should have the freedom to see what is lengthening your build time the most and attempt to cache that.

I would recommend providing the yarn path for caching, but for the archive processes, you won’t really be able to do that as of now. :slight_smile:

But must of all I’d recommend separating the iOS and Android flows, especially if you only have 45 minutes available to build

0 Likes

#3

thanks a lot, @bitce!

Actually, We splitted the flows so basically we have;

pre-build -> build (ios-build --> android-build) --> after-build --> create-release

flow at the moment. But also I put cache-push inside of ios-build and android-build and then put cache-pull on pre-build. I didn’t change anything on cache-pull or cache-push (so I just used default settings) but it doesn’t look like cache works. Is there any way also to make it parallel? Maybe it can help to reduce the time. Because long time taking doesn’t be good for bitrise servers as well :smiley:

This is example for ios

0 Likes

#4

@bitce, Is it possible to get support from the bitrise about this? I couldn’t find anything about support system, tbh.

0 Likes

#5

Hey @heyilker! :wave: I’d like to address your questions separately:

  1. In order to cache react native (i.e. cache dependenceis pulled via npm and yarn), you’d have to manually designate the appropriate directories for caching. You do that by adding the desired directories to the following Cache:Push step option (the pic below shows the default):

More information on caching in general here.

  1. Regarding parallelization: essentially, you’d need to utilize multiple concurrencies to run builds in parallel. Concurrencies are a feature of our Org plans, which you can view here. Provided you have an Org subscription and at least 2 concurrencies, you can start another Bitrise build in parallel using the Trigger Start Build step and keep your parallel builds in sync using the Bitrise Wait for Build step. Detailed info on that here.

Hope I was able to answer your questions here. :smile:

0 Likes