Carthage cache is not working (using Fastlane)

Hi,
we have an integration with Fastlane and using Carthage to deal with dependencies.
We are successfully leveraging caching locally to build dependencies only if needed.

However cache is not working when running on the CI, and as a result the dependencies are built every time.
From the logs I can see nothing is being cached during the cache-push step:

Summary
+------------------------------------------------------------------------------+
| (0) cache-pull                                                               |
+------------------------------------------------------------------------------+
| id: cache-pull                                                               |
| version: 2.0.1                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2019-02-28T08:27:03-08:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
2019/02/28 08:27:06 Cache pull...
2019/02/28 08:27:06 Failed to get download url, error: Build cache not found. Probably cache not initialised yet (first cache push initialises the cache), nothing to worry about ;)
e[33mWARNe[0m[08:27:06] Step (cache-pull) failed, but was marked as skippable 

Here’s the workflow definition:

    - cache-pull: {}
    - certificate-and-profile-installer:
        inputs: …
    - recursive-touch: {}
    - fastlane:
        inputs:
        - lane: wip
    - cache-push:
        run_if: .IsCI
        inputs:
        - ignore_check_on_paths: "$HOME/Library/Developer/Xcode/DerivedData"
        - cache_paths: |-
            "$HOME/Library/Developer/Xcode/DerivedData"
            ./Cartfile.resolved
            ./Carthage -> ./Cartfile.resolved

Our Fastfile is using a custom script to bootstrap Carthage dependencies (and perform extra manipulations)

carthage bootstrap --platform iOS --configuration Release --cache-builds

Can you help us understand why cache is not working?
FYI I’ve enabled Support Access.
Thank you.

Looks like there was an invalid format in my YML file, which I corrected now:

cache_paths: |-
path1
path2
path3

I can now see the cache is correctly used, however this does not solve the problem 100% of the times.
Most of our integration are not fetching cached data as they should be, this results in carthage having to build the dependencies.
What we would like to achieve is a simple build once and cache so that every other integration can benefit from cache.

How can we achieve this? thank you.

Hy there!

is the derived data path also in the ignore path list? if so, please remove it from there and try that way. and as far as I know carthage bootstrap should cache the builds as well :thinking:

the derived data is on both “ignore_checks” and “cache_paths”. are you saying I should remove this? how’s is this related?

Hy!

the DerivedData folder holds a lot of the iOS related dependencies. :upside_down_face:
but the thing that the carthage dependencies are not working, did you have any build where it worked properly? could you try with that carthage step version? :thinking:

yes we have different integration where we can see the cache is being used, others were it did not and as a result we could see in the log the classic message from Carthage:
“no cache found for XXX”

we could use the Carthage step version but we need to perform additional logic after the dependencies have been setup, so we are trying to keep all this logic within our Fastlane file.

I was wondering if you could provide more clarity on how the cache works, especially the difference when it runs on the main branch vs feature branch.
Ideally for us we want dependency of the save version to be built and cached once for all, regardless of the branch, so it would be great to know how to achieve this (either by using the default cache or via your cache api)

thank you

Hy there, I’m really sorry for the late reply😢

the cache depends on the branch, the child branch gets the parent’s cache as far as I know

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