iOS GitLab-CI 可持續(xù)化全自動打包上傳蒲公英

GitLab-CI就是一套配合GitLab使用的持續(xù)集成系統(tǒng)。

OS X系統(tǒng)完成可出現(xiàn)集成,需要安裝gitlab,gitlab-ci和runner,下面對gitlab-ci和runner詳細(xì)介紹。

gitlab中的CI

1、在gitlab中完成持續(xù)集成CI包括兩個操作:

? 配置一個Runner(用來編譯、測試、打包的服務(wù)器節(jié)點(diǎn))。

? 在項(xiàng)目根目錄增加YAML格式的CI腳本文件.gitlab-ci.yml。

2、安裝runner,下面是官網(wǎng)操作

溫馨提示:最好先把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

向系統(tǒng)獲取安裝權(quán)限:sudo chmod +x /usr/local/bin/gitlab-ci-multi-runner

開始安裝:gitlab-ci-multi-runner register

1、這步輸入自己gitlab網(wǎng)址

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、設(shè)置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


runner成功啟動后,可以再gitlab項(xiàng)目設(shè)置里看見啟動的runner,圖上顯示token,每個runner都有自己的runner token,runner內(nèi)有設(shè)置,runner可以設(shè)置為共有和私有,這樣為我們項(xiàng)目持續(xù)集成的工具有了。

3、下面就是設(shè)置yml文件

在gitlab管理項(xiàng)目的根目錄下創(chuàng)建.gitlab-ci.yml文件,這個文件就是觸發(fā)集成的關(guān)鍵。

這是yml文件的摸板:


./就是運(yùn)行打包腳本,ry.sh就是iOS工程打包腳本,在這個腳本里編寫打包命令。ry.sh文件也是在根目錄下存放。

這個是ry.sh的命令:

#這里用的是xcodebuild打包命令,主要注意路徑問題。

-php index.php是項(xiàng)目打包成功后,上傳蒲公英的腳本。index.php也是存到在根目錄下。

php命令:


4、這樣完成了runner的集成和腳本的編寫,在用xcode pull代碼的時候,gitlab-ci直接就集成打包,自動將代碼推到蒲公英上。

以上是自己自集成的時候流程,有不懂得或者不明白的或者錯誤的地方,歡迎指正,有碰到問題的也歡迎提問。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容