-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post: How to use CocoaPods with Xcode CI Bots #21
Comments
There's also a lot of info here: https://groups.google.com/d/msg/cocoapods/eYL8QB3XjyQ/10nmCRN8YxoJ |
So now we have at least 2 technique that works (and I have 1 complicated one). What is the best way to do this ? Should we write a blog post with all these techniques or prepare the gem we have discussed on the community chat? |
@kylef That tweet is unavailable :/ |
Looks like tweets were removed, but here's a screenshot from Tweetbot. |
I just finished setting up builds using Xcode bots this morning for our app which uses cocoa pods, however I will say that we are going to stick with Jenkins. So far my impression of bots is that they are meant for people who have never done CI before. They are EXTREMELY limited in capability (can’t monitor a build as it’s happening, build env can’t pass parameters to the build such as build numbers, can’t run scripts pre/post build etc, can’t administer a list of people allowed to download your test app, Xcode build list not auto-refreshed when new build is run, etc). Looks like the only thing you can do is what you can add to your build scheme, and the only feature benefit is Xcode integration (which sucks so far, was not even able to create a bot in Xcode, had to use web page) so you can link from automated test runs to source code. Neither of these warrant moving from Jenkinsish/Testflight solutions. All that is why we are NOT converting to bots, but if you want to use cocoa pods with bots here’s what I had to do: 1 - .go through the voodoo of setting up os x server and Xcode automation 2 - add .ssh with keys that can access your local pod repo to /var/teamsserver 3 - Set up new schemes specifically for Xcode bots 4 - Go http://yourserver/xcode and create the bot. Fairly short list of steps, but OS X server docs were no help at all. I’m really hoping this is just the starting point for bots, and that they will get a lot better in the future. Currently, even though jenkins is a much more complex CI server, I found myself pulling my hair out less setting up Jenkins than I did Xcode bots. Jenkins also supports something called a config matrix so you can run multiple build configs on a single checkout. On Nov 7, 2013, at 5:05 PM, Michele notifications@github.com wrote:
|
Thanks @amccarri for the detailed report! Much appreciated. |
I also took the Xcode bots for a test spin. I went a slightly different direction than @amccarri in my setup: Rather than creating a home directory at /var/teamsserver, I overrode the If your project contains private pods (I have a private pod repository), then you wind up needing to do double configuration of your SSH access. This is because the Xcode bots walk you through setting up an RSA key to clone your code, but that configuration is never exposed to the build once it begins. So you have to configure secured Git access separately from secured Pod access. This also applies for public Pods if you pull from Github via SSH instead of via HTTPS. Another irritating wrinkle is that you need to use a globally accessible Ruby installation for CocoaPods. If you are working off of the system Ruby and have done sudo installations of CocoaPods then it will work. But it’s pretty common (and often advisable) to see RVM or rbenv used to install parallel copies of Ruby. If you have these installed into your home directory and expect to use the same bits, then you are SOL. I went with an rbenv installation of Ruby into /usr/local/var/rbenv I also have Bundler managing some additional dependencies necessary for my build, so I wound up having to install the bundler dependencies into a path under the build directory. All of this required setting up pre build scripts on a Shared scheme, then pushing it remotely and testing, which was extremely slow and painful to work through. The build output also did not update until the build had failed, so there’s a lot of dead time waiting. Then once it was all set up, the feedback mechanisms were limited and it felt very much like a bunch of trouble for very little payoff when compared to Travis CI Pro or Jenkins. As to the ability to run tests on multiple devices: I am not convinced that there's actually any benefit in this over running your test suite across multiple versions of the Simulator. I've done tons of automated testing and CI on iOS over the last couple of years and the types of issues that we uncover on manual on-device testing are problems that are related to concurrency, unexpected user behaviors, and performance. The concurrency and user behavior problems won't become visible just because you run your suite on a device instead of the simulator and performance issues are typically perceputal -- a view "feels sluggish" or laggy. These kinds of conditions aren't testable in an automated way. There is also a major performance penalty to running your tests on real hardware. They are going to run much slower as you have slower processors, less memory, and less I/O throughput. The slower they are to execute, the lower your iteration throughput and the less you can lean on CI. So what's the benefit over the simulator? After giving CI bots a thorough tire-kicking, I ultimately went back to Jenkins and haven't looked back. My Jenkins setup is simpler and much more powerful/flexible. Hope this saves someone some wasted hours. |
Not unique to bots, you can do this with jenkins or any other CI tool that can run a command line build. From the xcodebuild man page: xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme -destination 'platform=iOS Simulator,name=iPhone' -destination I created a blog post out of my original email that includes a sample script for my bots config, can find it here: http://alexlikescode.blogspot.com On Nov 10, 2013, at 4:14 AM, Markos Charatzas notifications@github.com wrote:
|
@blakewatters thanks for the info! What kind of advantage do you see with the environment variables instead of the folder in @amccarri We already have instructions for other CI systems. This post will be specifically on Bots because so many people have asked about them. This isn't saying we recommend using Bots, but we should provide instructions on how to use cocoapods with them since Apple will likely push people to use them. |
@mtitolo sorry should have directed my comment, @qnoid was asking about bots' ability to run tests on multiple devices as an advantage over other solutions. I was just pointing out that running tests on multiple devices is not necessarily a feature of bots, but rather a feature of xcodebuild which can be used anywhere. |
Oh btw, here's my build pre-action script for using cocoa pods with bots:
|
So is this nixed for the minute? |
It still needs to happen. I haven't had the time to actually write the post and double check all of the solutions. |
BUMP. |
@swizzlr if you want to be useful, you could try one of the solutions listed above. |
Thanks, I will! |
Thanks @amccarri, your experience really helped me. Mac OS X 10.9.2, Xcode 5.1b5, CocoaPods 0.29.0 I created /var/teamsserver and set it's owner to _teamsserver. I created a scheme pre-action script: export PATH=/usr/local/opt/ruby/bin:/usr/local/bin:$PATH
brew update
brew upgrade
gem update --system
gem update cocoa pods
cd ${SRCROOT}
if [ -e "Pods" ]
then
pod update
else
pod install
fi It's working flawlessly. As a two-step set-up procedure, I'd say this is really not a problem. |
Alex, thank you for summarizing that. I'll see if I can try wrapping it into a cp plugin. |
Starting to work on the blog post for this. Comments welcome - https://github.com/CocoaPods/blog.cocoapods.org/blob/master/_drafts/CocoaPods-Bots.markdown This won't use any of the plugins (which may or may not work with Server anyway). |
That's great work everyone. I have all my builds compiling and my tests passing. I have, however, one error in my 'Analyze' phase. Everything else is great. Pre-script is run, pods are installed and linked. But Analyze seems to be the very first thing that runs, and I get that error. Any pointers? Thanks in advance! |
@egueiros not sure if this applies to your case. Check |
And another blog post for reference: http://chris.cm/setting-up-xcode-bots-with-cocoapods/ |
@egueiros I have the same issue, ld: library not found for -lPods |
@moayes You should normally change it on your project to |
I hacked something but right now i'm getting error when building some of static lib, locally everything is working fine :/:
Additionaly if i uncheck find implicit dependencies on shared target i'm getting
Update #1: |
Ah I was so close, I set the git remote to incorrectly and now having set it back correctly, I'm back at this error:
Oh well, it figures apple would make this such a laborious process. |
What is the URI of your remote? |
|
When I setup private repos, I use the ssh URI ( |
Do you mean you set the git remote to be |
The version with the semicolon before your project/username. |
Yeah not a clue. I went through and changed the remote of all my cocoapods to use ssh and re-added those into xcode using my public key authentication but it seems to be a lost cause. |
Also there needs to be .git at the end, like
|
Not |
I have a public/private key for the |
No, as long as you copied that public key to GitHub. And yes, the http was not supposed to be there, rather it should be
|
Ok cool. I ended up doing a complete clean of all my repos and set everything back the way it was and now I'm getting this:
(BZYBinders is one of my private pods) I think the solution here is to make all my private pods public and see if that works. |
Before you do that, can you log in as Making Pods public is really just a workaround, but I've been using private pods for years without a problem, so I know it's possible :) |
Cloning works super super duper! Do you think that possibly it's because my project has a private pod that uses another private pod as a dependency? I don't know how that would affect it but it seems to be unique from what most people are trying. And yeah! I'd love to be able to use private pods and Xcode bots. I've tried jenkins but that was a pain because you can only run in on a mac server and whatnot. |
Then your SSH keys are setup correctly! So it must be something with CocoaPods. Did you specify both private spec-repos with the |
Yup I put
at the top of all my Podfiles, not just my project but all my private pods as well to be on the safe side. |
AFAIK that shouldn't be a problem as long as both pods have their specs in one of the specified repositories. Anyway - I actually think you should create a new ticket with your specific setup, I'm sure you'll get help there quicker (this thread is otherwise getting off-topic). |
👍 |
If @startupthekid is still having issues with this, I had a similar problem: My private Pods also brought in other private Pods. Part of the problem is how the sources for the .podspecs are configured. Based on your error message, your podspec's s.source is https://, so it won't use the SSH Keys here. What's going to happen is the process is going to prompt for the username and password to be used. The way I worked around it was to copy my internet password from the login Keychain into the System keychain (making sure the ACL's were set correctly). Kind of a hack workaround, until I can figure out how to add internet and app passwords to _xcsbuildd's login keychain. |
@kaosdg Yeah the issue for me was that my private pod included other private pods of mine as dependencies so including them via https was throwing the error. Using git@ worked just fine. |
The new version of Xcode Server fixes this build issue with an actual user: |
Something that worked for me: |
I used Sever & Bots in Xcode 9, but It showed an error when integrating. Below was my Pre-Integration Scripts:
Below was part of the Log:
I don't know why it abort? How can I fix this error? |
Any updates? I would like to know complete steps to setup bot with cocoa pods dependencies. |
@lolgear I agree. I still get the error for podfile.lock not found and the sandbox is not in sync.... |
@nick3389 I think that issue is happening in Build Phase [CP] Check Pods Manifest.lock:
Don't know how to resolve this, did you get past it? |
@Apocryphon Yes everything is ok now!. Thanx! |
I use Xcode 9.4.1, I found a solution: log in as who create Bot if needed,
|
@nick3389 |
No description provided.
The text was updated successfully, but these errors were encountered: