iOS 自动化打包测试(使用jenkins、Tomcat、JDK实现)

来源:互联网 发布:kik是什么软件 编辑:程序博客网 时间:2024/04/20 05:31

大家知道,一般的打包测试比较简单,都是打成ipa包 ,大致流程就是 在工程里找到product文件夹下的.app文件 showInFunder后将其拖到iTunes里 再拖出来,ok 生成的ipa包就是这样普通打包测试的包。

!!!!!今天,主要记录一下自动化打包测试的步骤!!!!!   共勉~


#如何自动打包上传App


***


##一、安装配置Tomcat服务器

 

      预先安装JDKhttp://support.apple.com/kb/DL1572

    如果不能用,参考地址:http://wlb.wlb.blog.163.com/blog/static/467413201542121552401/

 

  1. 下载 apache-tomcatapache-tomcat-7.0.63为例([下载链接地址](http://pan.baidu.com/s/1pJ3M8Zp))。

 2. 解压Zip包,将解压的apache-tomcat-7.0.63文件拷贝到Library目录下,并更名为Tomcat. 

 3. 授予文件操作权限:sudo chmod 755 /Library/Tomcat/bin/*.sh

或:(sudo chmod 755 ~/Library/Tomcat/bin/*.sh)

 4. 运行startup.sh文件,命令:sh startup.sh (记得cdbin文件)

 5. 访问http://localhost:8080/,显示tomcat首页,tomcat安装启动成功。

 

  4-5步也可用其他方法:TomcatController.

  安装好后配置Preferences Tomcat Home Directory: /Library/Tomcat

  点击Start再点击 View 

   

  [TomcatController](http://pan.baidu.com/s/1jG7u5k6) 

 

 如果http://localhost:8080出现Apache Tomcat/7.0.63页面就说明Tomcat Ok了。

 

 

 

 ***

##二、添加JenKins war


  * 启动tomcat [jenkins.war](http://pan.baidu.com/s/1qWBSaBi)放到 Tomcat/webapps/目录下

  * 打开 http://localhost:8080/jenkins/ 

  

##三、配置JenKins


1. 系统管理/管理插件/可选插件选择下面插件并下载安装

gitlab plugin

Xcode integration

Python Plugin

Post-Build Script Plug-in

2. 系统管理/系统设置 


设置Xcode Builder:

 

添加Keychains设置 :

Keychain Name : 自行设置

    Keychain password: 自行设置

Default keychain: 

设置Jenkins Location:

设置系统管理员邮箱地址: 自行设置

配置git服务器 Git plugin:

Global Config user.name Value: 自行设置

Global Config user.email Value: 自行设置

配置gitlab:

Gitlab host URL : (gitlab 服务器地址)

API Token :自行设置 选择你的

 

3. 创建项目


新建 -新建项目 

1.项目名称

2.源码管理:Git  

  Repositories

Repository URL: 自行设置

Credentials : 添加-> 

Kind:SSH Username with private key

Username:自行设置

Private Key: (SSH Key)

  Branches to build : origin/master (git 分支)

3.构建触发器

4.构建 

添加构建步骤 Xcode

Target : 自行设置

Setting: Clean before build? YES;

勾选Pack application and build .ipa?

.ipa filename pattern :WeiXiang

Output directory: $(WORKSPACE)/build

Manifest Plist URL:$(WORKSPACE)/build

Code signing & OS X keychain options:

勾选Change bundle ID 

New bundle ID : 证书对应的APPBundleID

Info.plist paht :$(WORKSPACE)/WeiXiang/info.plist

Code Signing Identity: (发布证书名称)

勾选Unlock keyChain:选择第二步设置的

Advanced Xcode build options

勾选 Clean test reports?

Custom xcodebuild argument.." 

添加构建后操作步骤:(需要Post-Build Script Plug-in插件)

Execute a set of scripts -add Build setp - Execute Python script

(Python脚本build成功后启动脚本自动打包到蒲公英并发送邮件。)立即构建

 

 



---------

* 相关链接

*   http://blog.csdn.net/liuc0317/article/details/10594867

* http://chuansong.me/n/1447981 

* https://www.5288z.com/?p=1411   

http://www.jianshu.com/p/c69deb29720d

https://wiki.jenkins-ci.org/display/JENKINS/Xcode+Plugin


 

 


1 0