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
yarn takes 4mins
xcode-archive takes 17mins
android build takes 11mins
and off course we have some other steps as well
So, the caching structure isn’t specific to any platform or frameworks 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.
But must of all I’d recommend separating the iOS and Android flows, especially if you only have 45 minutes available to build
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
Hey @heyilker! I’d like to address your questions separately:
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):
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.