简介:
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.
配置要求
- 一台Mac用作Server
- 若干Mac开发机
- OS Server软件
配置步骤
一:OS X Server的配置:
-
OS X Server app下载链接: http://chinamac.dbank.com/c0ju1oq2du
-
安装好OS X Server后,设置Xcode Service
2.1 设置代码仓库(Repositories),(我的代码仓库是在Github上,我测试的时候使用SSH连接会失败,然后使用HTTPS就正常连接)
2.2 设置Xcode service的权限(修改Xcode Service Bot的权限等),分三种:
* 登录用户
* 任何用户
* 部分用户
2.3 开启Xcode service.
1.pic.jpg
二:Xcode的配置:
2.pic.jpg
- 在Xcode的Preference -> Accounts -> Add Server ,添加一个OS X Server ,然后输入相关配置.
到这里 ,OS X Server 的Xcoder Service 还有 Xcode都设置好了.现在可以添加一个Bot来进行自动测试了.
3.pic.jpg
What is Bot:
what is a Bot.png
进行自动化测试之前,首先,我们需要创建一个Bot.
Bot有几种类型:
- 每次代码仓库的commit,都会触发
- 定期触发
Bot可以在Xcode或者浏览器管理页面上进行手动触发.
在Xcode的Product -> Create Bot来创建一个Bot.
create a bot.png
Why Xcode Service?
- 配置超级简单.
- OS X Server的UI十分漂亮
- 成本几乎可以忽略不算.(OS X Server价格:128软妹纸)
- 使用简单,与Xcode无缝连接(操作都在Xcode上可以完成)
- 一条龙服务:静态代码分析,单元测试,持续集成归档.
- OS X Server下的Xcode Service只是一小部分功能,还有wiki(可以建立团队的知识库)等其它实用的功能.
- 并且在WWDC上可以看出,Apple的Xcode team把自动化测试做得越来越好.
- 在Server端,可以同时测试多台真机,多台模拟机.
我们使用的是gitlab做代码仓库,在Xcode上配置好OS Server之后,集成的时候会出现权限问题:
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
目录下.
网友评论