文章轉(zhuǎn)自:@dee
簡(jiǎn)介:
About Continuous Integration in Xcode
Xcode supports a continuous integration workflow through the Xcode service. The Xcode service, available in OS X Server, automates the integration process of building, analyzing, testing, and archiving your app. From your development Mac, you create bots that run on a separate server, where they perform these integrations. Bots help ensure that your product is always in a releasable state—and when there’s a failure, the service notifies you or the person whose code change caused the failure.
配置要求
一臺(tái)Mac用作Server
若干Mac開發(fā)機(jī)
OS Server軟件
配置步驟
一:OS X Server的配置:
OS X Server app下載鏈接:http://chinamac.dbank.com/c0ju1oq2du
安裝好OS X Server后,設(shè)置Xcode Service
2.1 設(shè)置代碼倉(cāng)庫(kù)(Repositories),(我的代碼倉(cāng)庫(kù)是在Github上,我測(cè)試的時(shí)候使用SSH連接會(huì)失敗,然后使用HTTPS就正常連接)
2.2 設(shè)置Xcode service的權(quán)限(修改Xcode Service Bot的權(quán)限等),分三種:
* 登錄用戶
* 任何用戶
* 部分用戶
2.3 開啟Xcode service.
二:Xcode的配置:
在Xcode的Preference -> Accounts -> Add Server ,添加一個(gè)OS X Server ,然后輸入相關(guān)配置.
到這里 ,OS X Server 的Xcoder Service 還有 Xcode都設(shè)置好了.現(xiàn)在可以添加一個(gè)Bot來(lái)進(jìn)行自動(dòng)測(cè)試了.
What is Bot:
進(jìn)行自動(dòng)化測(cè)試之前,首先,我們需要?jiǎng)?chuàng)建一個(gè)Bot.
Bot有幾種類型:
每次代碼倉(cāng)庫(kù)的commit,都會(huì)觸發(fā)
定期觸發(fā)
Bot可以在Xcode或者瀏覽器管理頁(yè)面上進(jìn)行手動(dòng)觸發(fā).
在Xcode的Product -> Create Bot來(lái)創(chuàng)建一個(gè)Bot.
Why Xcode Service?
配置超級(jí)簡(jiǎn)單.
OS X Server的UI十分漂亮
成本幾乎可以忽略不算.(OS X Server價(jià)格:128軟妹紙)
使用簡(jiǎn)單,與Xcode無(wú)縫連接(操作都在Xcode上可以完成)
一條龍服務(wù):靜態(tài)代碼分析,單元測(cè)試,持續(xù)集成歸檔.
OS X Server下的Xcode Service只是一小部分功能,還有wiki(可以建立團(tuán)隊(duì)的知識(shí)庫(kù))等其它實(shí)用的功能.
并且在WWDC上可以看出,Apple的Xcode team把自動(dòng)化測(cè)試做得越來(lái)越好.
在Server端,可以同時(shí)測(cè)試多臺(tái)真機(jī),多臺(tái)模擬機(jī).
我們使用的是gitlab做代碼倉(cāng)庫(kù),在Xcode上配置好OS Server之后,集成的時(shí)候會(huì)出現(xiàn)權(quán)限問(wèn)題:
debug1: Trying private key: /var/empty/.ssh/id_rsa
debug1: Trying private key: /var/empty/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解決方法是將public key還有private key文件分別移到/var/empty/.ssh/id_rsa,/var/empty/.ssh/id_dsa目錄下.