2013-11-15 16 views
22

私はiOSアプリケーション用のCIの設定に取り組んでおり、いくつかの問題に直面しています。ボット用のカスタムトリガースクリプト(Xcode 5 CI)

  • Botはどこの文書を見つけるのに適していますか?私はXcodeの ヘルプを見てきましたが、任意の良い例を見つけるカント、また、そのたびに 2013会議私は、カスタム・トリガースクリプトを作成するにはどうすればよい
  • からCIのビデオを見て、開発者 は、それが自動的にボットをトリガーする彼らのコードをコミット。
  • テストが正常に ロボットに渡された場合にのみ、コードをマスターにマージするにはどうすればよいですか?私は https://help.apple.com/xcode/mac/1.0/#apdE6540C63-ADB5-4B07-89B7-6223EC40B59C

    例の値はそれぞれの設定で表示されたトリガスクリプトに関する情報を発見したのはここ

です。スケジュール:手動で、定期的に、新しいコミットで を実行するか、トリガースクリプトで実行するかを選択します。

ありがとうございます!

答えて

0

ボットの計画では、テスト結果を解析するポストビルドスクリプトを作成します。

テスト結果は次の場所にあります。

/Library/Server/Xcode/Data/BotRuns/Latest/output/xcodebuild_result.bundle/Info.plist 

あなたがテストがそのPLISTに渡していることを確認したら、あなたはマスターにマージすることができます。

次に、誰かがマスターにプッシュしたときに統合するボットを作成します。私は、ボットのスケジュールを編集することは、変更のためのレポをポーリングするオプションがあると思う。ボットが現在マスタになっているXcodeプロジェクトによって作成されていることを確認します。

作成するテストブランチ上にXcodeがある場合は、最初のボットを作成する必要があります。

2

アップルのデベロッパーWebサイトにはContinuous Integration Guideがあり、CIビルドの設定方法の詳細な説明が記載されています。しかし、トリガースクリプトの詳細は不足しています。

そのための最良のドキュメントは、OSX Serverスクリプト自体にあります。ここでAppleが使用する「トリガースクリプト」という用語は、Gitのポスト受信フックを指します。 Gitイベントフックは、Gitリポジトリの.git/hooksサブディレクトリに追加して、それらを含むGitリポジトリのイベントに応答してアクションを実行することができます。

CIビルドを実行するためにXcodeサービスを特に「キック」する受信後のフックの例を見るには、XcodeビルドサービスをホストしているサーバーでホストされたGitリポジトリを作成します。デフォルトでは、Xcodeサーバーに追加されたGitリポジトリには受信後のフックが自動的に作成されます。この場合、POSTからhttp://localhost/xcs/kick-commit-botsrepositorybranchのフォームフィールドが(Xcodeサービスで設定されているように)リポジトリのURLに設定され、分岐がそれぞれプルするRubyスクリプトです。

したがって、「Xcode Continuous Integration Guide」に記載されている手順に従ってホストされたリポジトリを作成し、Xcodeサーバー上の/Library/Server/Xcode/Repositories/git/<your project>.git/hooks/post-receiveの内容を表示します。 Gitプロジェクトを他の場所でホストしている場合(例:BitBucket、GitHub、またはローカルネットワーク上のLinuxボックス)を使用して、スクリプト言語で独自のポスト受信フックを作成する際に、このファイルを参考にすることができます。

#!/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 
:自分のビルドサーバー上でホストされているレポを作成するオプションを持っていない人のため

関連する問題