I am working on setting up CI for my iOS application and I am facing some issues.
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!
When Xcode Cloud executes a new build, the custom build scripts are automatically detected and run at their designated time in the timeline. To create the ci_scripts directory, navigate to the Project Navigator in Xcode and Control-click your project, choose New Group to create the group and its corresponding directory, and name it ci_scripts.
To create the ci_scripts directory: Open your project or workspace in Xcode and navigate to the Project navigator. In the Project navigator, Control-click your project and choose New Group to create the group and its corresponding directory.
Right-click on your bot project and select Add > Project Reference. Choose the MemberUpdates project and click OK. Build the entire solution to restore all packages and validate the dependency tree. Custom triggers extend the base OnActivity class, adding an expression in order to respond to specific events.
To create a custom trigger (or any component), first setup a new project, and add the necessary package dependencies for working with adaptive dialogs and the Bot Framework SDK. Locate the solution (.sln) file for your bot, and open it in an editor (like Visual Studio or Visual Studio Code). Add a new project named MemberUpdates to your solution.
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 to http://localhost/xcs/kick-commit-bots
with repository
and branch
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:
#!/usr/bin/env ruby ## # Copyright (c) 2014 Apple Inc. All Rights Reserved. # # IMPORTANT NOTE: This file is licensed only for use on Apple-branded # computers and is subject to the terms and conditions of the Apple Software # License Agreement accompanying the package this file is a part of. # You may not port this file to another platform without Apple's written consent. # # IMPORTANT NOTE: This file is licensed only for use with the Wiki Server feature # of the Apple Software and is subject to the terms and conditions of the Apple # Software License Agreement accompanying the package this file is part of. ## # fill in the exact URL to your repository, as entered in your OS X Server configuration $repository_url = "file:///git/python-lrparser.git" $repository_mode = "git" # fill in the hostname of your OS X Server machine; this must be accessible by the server # on which your repository is hosted; you may use "localhost" for the local machine #server_host = "server.example.com" $server_host = "localhost" ########################################## ## DO NOT EDIT BELOW THIS LINE ########################################## require 'net/http' def kick(branch) theURL = URI("http://#{$server_host}/xcs/kick-commit-bots") if branch.nil? Net::HTTP.post_form(theURL, 'repository' => $repository_url) else Net::HTTP.post_form(theURL, 'repository' => $repository_url, 'branch' => branch) end end if __FILE__ == $0 # determine what branch this is a push to, if possible branches = [] if $repository_mode == "git" $stdin.each_line do |line| oldrev, newrev, ref = line.strip.split if ref =~ %r{^refs/heads/(.+)$} branches.push($~[1]) end end elsif $repository_mode == "svn" and ARGV.length >= 2 repository = ARGV[0] revision = ARGV[1] modifiedDirs = `svnlook dirs-changed -r #{revision} #{repository}`.lines.map { |line| line.chomp } modifiedDirs.each do |d| if d =~ %r{branches/([^/]+)} branches.push($~[1]) end end end # if we have no branch information, just kick generically puts "Notifying OS X Server..." if branches.empty? kick(nil) else # otherwise, do a targeted kick for each relevant branch branches.each do |branch| kick(branch) end end end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With