I am working on setting up CI for my iOS application and I am facing some issues.
- Where is a good place to find documents on Bot? I have seen the Xcode help but cant find any good example, also watched the CI video from 2013 conference
- How do i create a custom trigger script, so every time a developer commits their code it will automatically trigger the bot.
- How do I merge the code to master only if Test successfully passes the bot?
Here is where I found info about trigger scripts https://help.apple.com/xcode/mac/1.0/#apdE6540C63-ADB5-4B07-89B7-6223EC40B59C
Example values are shown with each setting. Schedule: Choose to run manually, periodically, on new commits, or on trigger scripts.
Thank you!
In the bot's scheme, create a post build script that parses the test results.
The test results will be located here:
Once you verify that the tests pass in that plist, you can merge into master.
Then create a bot that only integrates when someone pushes to master. I believe editing the bot's schedule has an option for polling a repo for changes. Make sure the bot is created by an Xcode project that is currently on master.
The first bot would need to be created when Xcode is on the test branch you would create.
There is a Continuous Integration Guide available on the Apple developer website which provides detailed explanations of how to set up your CI builds. It lacks details on trigger scripts however.
For that the best documentation is found in the OSX Server scripts themselves. The term "trigger scripts" as used here by Apple refers to post-receive hooks in Git. Git event hooks can be added to the .git/hooks subdirectory of any Git repository to perform actions in response to events on the Git repository which contains them.
To see an example post-receive hook which specifically "kicks" an Xcode service to run CI builds, create a hosted Git repository on the server hosting your Xcode build service. By default, Git repositories added to an Xcode server will have a post-receive hook created automatically. In this case it is a Ruby script which
POST
s tohttp://localhost/xcs/kick-commit-bots
withrepository
andbranch
form fields set to the URL of the repository (as it is configured in the Xcode service) and the branch to pull respectively.So, create a hosted repository by following the steps outlined in the Xcode Continuous Integration Guide and then view the contents of
/Library/Server/Xcode/Repositories/git/<your project>.git/hooks/post-receive
on the Xcode server. If you host your Git projects elsewhere (e.g. BitBucket, GitHub or a linux box on your local network) you can use this file as a guide when creating your own post-receive hook in your scripting language of choice.An example for those who don't have the option of creating a hosted repo on their build server: