How can I reduce build time caching xcode-archive?

I have a build that spend 40min only on xcode-archive, and 3 or less minutes on other steps, I would like to cache my xcode-archive but I tried some things and doesn’t work.

9 Likes

I’m also interested on this. We’re using SPM and it seems to cache only source code but not builds. It rebuilds dependencies every time we perform archive.

Hello @cmonteirodialpad :wave:

Since the difference between project and project can be virtually limitless, unfortunately this means that there is no universal solution for performance improvement that would fit every project, and we need to look at these apps case-by-case.

Could you please send us a related build URL and enable Support Access (Enabling the Bitrise Support user for your app | Bitrise DevCenter ) so that we may take a closer look? :slight_smile:

Hello Roland, could you check one of my builds please?

@Roland-Bak This is more of a general question. I know my builds are taking a long time to build SPM packages from scratch, I’m looking for a way to cache SPM packages already built from derived data.

Hello @jonathan.souza :wave:

Seems like your builds are not using cache on this build, which is why the process takes so long.

The Cache:Push Step does not run when a build is triggered by a pull request and no cache is saved.

This is intentional.
By default, the Cache:Push Step is skipped when a build is triggered by a pull request. If you look at the step.yml for the Step, you will see the run_if statement:

run_if: ".IsCI | and (not .IsPR)" ``

This evaluates to false for Pull Requests. As a result, the step is not executed.

You can change this behavior by changing or deleting the run_if statement, but this is not recommended! Our recommendation is to only allow manual or CI builds to generate and save the cache. For security, a build triggered by a pull request should only be able to access the cache but not change it.

You can read more about how caching works at Bitrise here: Cache:Push Step

And about step conditionality: Enabling or disabling a Step conditionally

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.