I have errors with Xcode cloud testing while archiving.
Issues are all related to CocoaPods dependencies:
unable to open file (in target "Alamofire" in project "Pods")
missing module map file: '/Volumes/workspace/repository/Pods/Target Support Files/Alamofire/Alamofire.modulemap
Looks like pods are not being installed on archiving.
It works well locally.
Best,
3
Answers
The answer is here for CocoaPods, Carthage or SPM : https://developer.apple.com/documentation/xcode/making-dependencies-available-to-xcode-cloud#Use-a-Custom-Build-Script-to-Install-a-Third-Party-Dependency-or-Tool
Xcode Cloud temporary build environment doesn’t include third party tools like CocoaPods. But you can include them using post clone script. Here are the steps if you are using CocoaPods.
Create a directory
ci_scripts
at the root of your project.Add a file
ci_post_clone.sh
and save it in the ci_scripts directory.Open
Terminal
and make your script executable be runningchmod +x ci_post_clone.sh
inci_scripts
directory.Edit the
ci_post_clone.sh
in any text editor and copy the following.Commit and push
ci_post_clone.sh
.The documentation suggested way of setting this up is terrible – it has no versioning, and it takes a lot of time to install through brew.
The best way is having a
Gemfile
that declares the dependencies at the root of your repo, ie:Then
bundle install
it to lock the versions of the tools on aGemfile.lock
(you should version both files in your repo).On your
ci_scripts/ci_post_clone.sh
file:Also, consider commiting your
Pods
folder to avoid the need to run cocoapods at all. Or at least gitignore only large binaries (i.e Twilio, WebRTC, etc). This also protects you from deleted repos or offline services providers