iOS 持续集成"/>
iOS 持续集成
今天用Jenkins+iOS+fir+蒲公英 搭建持续集成环境,把过程记录一下。
第一步:安装Jenkins
方法一:直接去官网下载安装包
下载地址:/
下载后直接点击进入安装
安装完成后在Terminal中输入命令,打开Jenkins:
open /Applications/Jenkins/jenkins.war
方法二:使用命令行安装
1.安装 home-brew(安装指导)
ruby -e “$(curl -fsSL )”
2.安装 Jenkins
$ brew install jenkins
3.启动 Jenkins
$ jenkins
4.在浏览器输入地址:
http://localhost:8080/
使用安装包安装后会自动打开,如果端口冲突那么请修改端口
defaults write/Library/Preferences/org.jenkins-ci httpPort 8888
第二步:启动Jenkins后使用浏览器访问Jenkins
http://localhost:8080/
访问成功后显示如下:
第三步:安装插件
在“系统管理” -> “插件管理”中添加如下这个插件:
Xcode integration
左边菜单栏找到插件管理
第四步:新建项目
(1)新建项目
点击左侧工具栏”新建”,
输入项目名称,
选择第一项”构建一个自由风格的软件项目”
(2)基本信息
(3)源码管理信息
如果你是用的是Git,那就请选择Git,然后输入你的仓库地址:
如果你是用的是SVN,那就请选择Subversion,然后输入你的仓库地址:
(4)自动构建时机
这里就是告诉jenkins什么时候自动构建,当然也可以不设置。
关于定时器的格式,我只能从网上摘抄一段稍微靠谱一点的说明:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
举两个例子:
- 1
- 2
- 3
- 4
- 1
- 2
- 3
- 4
(5)构建
添加构建步骤 -> Xcode基本信息
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
添加构建步骤 -> Xcode证书信息
我这里是在上传至Git的项目里已经配置过证书和Provisioning Profiles。
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
login.keychain的路径在哪?
点击”系统管理”中的”系统设置”,Xcode Build中的Keychains
注意!
如果项目使用了cocoapods,需要配置Advanced Xcode build options,设置
-
Schema
-
SDK iphoneos
-
Workspace File(不用加.xcworkspace)
-
Build output directory 也设为${WORKSPACE}/build/
(6)构建后操作
添加构建后操作步骤
1.你可以选择上传到fir:
fir的地址:/
也可以选择上传到蒲公英:
蒲公英的地址:/
2.你也可以选择命令行
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
新版fir.im的API Token获取方式见下面:
请注意,在使用该命令前请先确认安装fir-cli,安装命令如下:
Mac OS X 10.11 以后的版本, 由于10.11引入了 rootless, 无法直接安装 fir-cli, 有以下三种解决办法:
1.使用 Homebrew 及 RVM 安装 Ruby, 再安装 fir-cli(推荐)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
2.指定 fir-cli 中 bin 文件的 PATH
- 1
- 1
3.重写 Ruby Gem 的 bindir
- 1
- 2
- 1
- 2
上面的命令来自 fir.im 的工具 fir-cli,这是他们的官方使用说明
fir.im测试平台通过他自家的工具fir-cli上传ipa包:
- 1
- 1
蒲公英测试平台通过curl上传ipa包:
- 1
- 1
完成,点击保存。
(7)点击立即构建
构建成功标志位置为蓝色,失败为红色。
查看fir.im,应用上传成功:
查看蒲公英,应用上传成功:
原地址:
更多推荐
iOS 持续集成
发布评论