iOS GitLab-CI 可持续化全自动打包上传蒲公英

GitLab-CI就是一套配合GitLab使用的持续集成系统。

OS X系统完成可出现集成,需要安装gitlab,gitlab-ci和runner,下面对gitlab-ci和runner详细介绍。

gitlab中的CI

1、在gitlab中完成持续集成CI包括两个操作:

• 配置一个Runner(用来编译、测试、打包的服务器节点)。

• 在项目根目录增加YAML格式的CI脚本文件.gitlab-ci.yml。

2、安装runner,下面是官网操作

温馨提示:最好先把rvm和ruby升到最新版。

https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/osx.md

操作:

打开终端,下载安装包:sudo curl –output /usr/local/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-darwin-amd64

向系统获取安装权限:sudo chmod +x /usr/local/bin/gitlab-ci-multi-runner

开始安装:gitlab-ci-multi-runner register

1、这步输入自己gitlab网址

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )

https://gitlab.com

2、填注册token

Please enter the gitlab-ci token for this runner

xxx

3、这是runner的描述

Please enter the gitlab-ci description for this runner

my-runner

4、设置runner tags

Please enter the gitlab-ci tags for this runner (comma separated):

iOS

5、这是写用什么脚本,一般用shell

Please enter the executor: shell, docker, docker-ssh, ssh?

shell

6、安装成功后

Runner registered successfully. Feel free to start it, but if it’s

running already the config should be automatically reloaded!

启动

gitlab-ci-multi-runner install

gitlab-ci-multi-runner start

《iOS GitLab-CI 可持续化全自动打包上传蒲公英》

runner成功启动后,可以再gitlab项目设置里看见启动的runner,图上显示token,每个runner都有自己的runner token,runner内有设置,runner可以设置为共有和私有,这样为我们项目持续集成的工具有了。

3、下面就是设置yml文件

在gitlab管理项目的根目录下创建.gitlab-ci.yml文件,这个文件就是触发集成的关键。

这是yml文件的摸板:

《iOS GitLab-CI 可持续化全自动打包上传蒲公英》

./就是运行打包脚本,ry.sh就是iOS工程打包脚本,在这个脚本里编写打包命令。ry.sh文件也是在根目录下存放。

这个是ry.sh的命令:

《iOS GitLab-CI 可持续化全自动打包上传蒲公英》

#这里用的是xcodebuild打包命令,主要注意路径问题。

-php index.php是项目打包成功后,上传蒲公英的脚本。index.php也是存到在根目录下。

php命令:

《iOS GitLab-CI 可持续化全自动打包上传蒲公英》

4、这样完成了runner的集成和脚本的编写,在用xcode pull代码的时候,gitlab-ci直接就集成打包,自动将代码推到蒲公英上。

以上是自己自集成的时候流程,有不懂得或者不明白的或者错误的地方,欢迎指正,有碰到问题的也欢迎提问。

    原文作者:paradisery
    原文地址: https://www.jianshu.com/p/f23e32d85187
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞