Xcode Server实现持续集成

最近在研究--》iOS开发持续集成

Jenkins是一种方案,作为iOS开发自带Xcode服务,也是支持自动化集成打包的。因此,研究下,苹果帮助。

Xcode 服务是用于自动化软件静态分析、单元测试和版本归档的持续整合系统。

  • 下载 Mac OS Server

在服务器(其他MacBook等)上安装完Mac OS Server,奇怪的是我的只有一个“描述文件管理器”的服务

[图片上传失败...(image-2e898f-1562474122754)]

  • Xcode配置

1、Accounts 添加 Servers

一般默认自己主机,也可以选择指定IP地址,按服务器配置时对应选择;需要填写用户名,密码。添加后如下图

[图片上传失败...(image-bfb0f4-1562474122754)]

2、注意 Source Control 需要打开才能使用!

[图片上传失败...(image-712b14-1562474122754)]

3、Bot 配置

Xcode 托管软件版本控制储存库 (Git),检出源代码,以及根据指示执行其整合任务。此自动化指令离散集在 Xcode 服务中称为 Bot。

3.1、创建Bot (自动机器人)

[图片上传失败...(image-ab9417-1562474122754)]

3.2、Bot命名与服务器选择,基本默认不改

[图片上传失败...(image-e20ddd-1562474122754)]

3.3、选择项目内容,后面的master,可选其他分支,比如develop;

[图片上传失败...(image-a13911-1562474122754)]

注:如未登录git,需要先登录

[图片上传失败...(image-9e77f2-1562474122754)]

3.4、Bot 操作配置

  • Scheme:默认项目本身
  • Actions:分析Analyze;单元测试Test(测试项目没开单元测试所有没的选);打包Archive;
  • Configuation:项目配置;

[图片上传失败...(image-8d4c55-1562474122754)]

3.5、Integrate、Clean:合并和清理周期时间,比如选择了一周清理一次;

[图片上传失败...(image-548b6e-1562474122754)]

3.6、Choose the device types that this bot will build for: iOS Devices and Simulators

3.7、配置证书与描述文件

[图片上传失败...(image-1dd414-1562474122754)]

3.8、环境变量配置,暂无(有必要可以添加)

3.9、添加脚本

bot会先checkout代码到临时文件夹,然后执行编译前的脚本,编译,然后执行编译后的脚本。

configure bot triggers

  • Pre-integration script 编译前脚本

比如说遇上Cocoa pods,

  • Post integration script 集成之后脚本

When you hack too much and Xcode Server goes crazy, you need a way to reset all of its state and start over.the command is:

sudo xcrun xcscontrol --reset

Be careful, all your bots and integration data will be deleted as well.

$ sudo /Applications/Xcode-beta6.app/Contents/Developer/usr/bin/xcscontrol --help Usage: xcscontrol [options] -h, --help, --usage Prints usage information for xcscontrol --version Displays version information --preflight Preflights the Xcode Server service --initialize Initializes Xcode Server, must be called before the service is usable --reset Resets Xcode Server, removing all service data and stopping all services --restart Restart Xcode Server without removing any service data --shutdown Stops Xcode Server --health Fetches and displays server status and statistics --fix-permissions Sets permissions on the shared data directory to their defaults --list-portal-teams APPLEID PASSWORD Lists valid ADC teams for a given Apple ID and password --join-portal-team TEAMID APPLEID PASSWORD Joins a given ADC team with a supplied Apple ID and password --verify-portal-support TEAMID APPLEID PASSWORD Tests ADC support for a given team, Apple ID and password --sync-portal Syncs all teams with the ADC portal --sync-portal-team TEAMID Syncs a specific team with the ADC portal --add-device-to-team DEVICEUDID DEVICENAME TEAMID Adds a device with a given UDID and name to ADC team with given ID --list-devices Lists all known (physical) devices for testing --list-simulators Lists all known simulators for testing --set-device-development-bit DEVICEUDID Configures a device with a given UDID for development --configure-email-from-name DISPLAY NAME Configures a display name to be used in the from field when delivering email notifications --configure-email-from-address ADDRESS Configures an address to be used in the from field when delivering email notifications --configure-email-reply-to-name DISPLAY NAME Configures a display name to be used in the reply-to field when delivering email notifications --configure-email-reply-to-address ADDRESS Configures an address to be used in the reply-to field when delivering email notifications --configure-email-transport RELAY Configures an SMTP relay for delivering email notifications

http://note.youdao.com/noteshare?id=c0c2d37426dbd252c253374783497580

你可能感兴趣的:(Xcode Server实现持续集成)