Gitlab Ci iOS持续集成尝试 xcodebuild + xcpretty + altool

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


因为用的是mac,所以下载
//查找不同版本runner
https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v9.0.0/index.html

下载成功后,把文件移到/usr/local/bin路径下
我将文件名称改为gitlab-runner
开启文件可执行权
chmod +x gitlab-runner

 然后注册  启动

 


注册成功后


配置.gitlab-ci.yml文件




//关于altool使用
http://help.apple.com/itc/apploader/#/apdATD1E927-D1E1A1303-D1E927A1126
安装:xcpretty
1.检查Ruby版本,需要2.0及以上版本。在终端输入以下命令确认:
ruby -v

 2.将gem的source改为https://gems.ruby-china.org/。

gem sources

 结果应为:

[ming:~]$ gem sources
*** CURRENT SOURCES ***

https://gems.ruby-china.org/

 3.检查Xcode命令行工具是否安装。在终端输入以下命令:

xcode-select --install

安装成功:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

 如果没有安装会进行安装



4.安装xcpretty

sudo gem install xcpretty --verbose

 如遇到

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/rougify

 使用

 sudo gem install -n /usr/local/bin xcpretty

 错误:

ERROR:  While executing gem ... (OpenSSL::SSL::SSLError)
    hostname "upyun.gems.ruby-china.org" does not match the server certificate

 执行指令

gem source -l

 如

*** CURRENT SOURCES ***

https://gems.ruby-china.org/

 将https://gems.ruby-china.org/换为http://gems.ruby-china.org/

gem sources --remove https://gems.ruby-china.org/
gem sources -a http://gems.ruby-china.org/

 

 

 

 

 


遇到问题:
1.
Running with gitlab-ci-multi-runner 9.3.0 (3df822b)
  on my-runner (cb0c8455)
Using Shell executor...
Running on ming.local...
Cloning repository...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
解决:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
查看: xcode-select --print-path
2.
Running with gitlab-ci-multi-runner 9.3.0 (3df822b)
  on my-runner (cb0c8455)
Using Shell executor...
Running on ming.local...
Cloning repository...
Cloning into '/Users/ming/builds/cb0c8455/0/MJHelloWorld/mfmm'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
ERROR: Job failed: exit status 1

 解决:项目文件太大,将误提交的pod文件删除

3.

$ pod update --verbose
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
	from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
	from /usr/local/bin/pod:22:in `<main>'
Running after script...
$ chmod +x ts.sh
chmod: ts.sh: No such file or directory
ERROR: Job failed: exit status 1

 解决:

which pod
sudo rm -rf /usr/local/bin/pod
sudo gem install  cocoapods
pod setup

又 遇到相同问题但是解决方法为

gem install xcpretty

 4

$ xcodebuild -exportArchive -archivePath $PWD/build/mfmm.xcarchive -exportOptionsPlist exportOptionsRelease.plist -exportPath $PWD/build
2017-08-02 15:25:35.827 xcodebuild[22810:1303966] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/l1/_9jqf4qd38v951p9mv7j6j5r0000gn/T/mfmm_2017-08-02_15-25-35.826.xcdistributionlogs'.
2017-08-02 15:25:36.383 xcodebuild[22810:1303966] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fc7a86aea30>: Error Domain=IDEDistributionErrorDomain Code=1 "No valid iOS Distribution signing identities belonging to team 5893HE3KPR were found." UserInfo={NSLocalizedDescription=No valid iOS Distribution signing identities belonging to team 5893HE3KPR were found.}
error: exportArchive: No valid iOS Distribution signing identities belonging to team 5893HE3KPR were found.

Error Domain=IDEDistributionErrorDomain Code=1 "No valid iOS Distribution signing identities belonging to team 5893HE3KPR were found." UserInfo={NSLocalizedDescription=No valid iOS Distribution signing identities belonging to team 5893HE3KPR were found.}

 解决

在xcode中Produck -> Archive成功后

 

在下一步中会提示错误,选择reset之后,再Try Again  如果正常运行,问题就解决了,可以cancle了

 
posted @ 2017-07-31 16:10  MJHelloWorld  阅读(1586)  评论(0编辑  收藏  举报