Search code examples
swiftxcodegit-lfsxcode-cloud

How do you get Xcode Cloud to download Git LFS images?


I am trying to run Xcode Cloud on my unit tests, which include a large number of snapshot tests using png images that are all stored using Git LFS. But when I run the tests on Xcode Cloud, the logs indicate that the images aren't on disk, implying they haven't been downloaded from Git LFS. The documentation says Xcode Cloud comes with Git LFS support but doesn't indicate you need to do anything special to set it up for Xcode Cloud. I've connected Xcode Cloud to my repo, and it shows the tests running, but they're failing because the images are missing.

I have a .gitattributes file at the root level of my repository which contains rules for adding various image file formats to Git LFS. For example, one line says:

*.png filter=lfs diff=lfs merge=lfs -text

What am I missing here? How do I get Xcode Cloud to fetch Git LFS files when it checks out my repo?


Solution

  • As I posed on Apple Developer Forums,

    As it turns out, Xcode Cloud is not having any trouble fetching the images. The issue was that Xcode Cloud builds the tests on one machine and then passes the test bundle onto another machine which doesn't have access to the repo, so it doesn't have any of the images. Needed to use symlinks and Xcode Cloud build scripts to fix it.