Quantcast
Channel: polygun2000的博客
Viewing all articles
Browse latest Browse all 55

ios构建机配置指南-gitlab/CI

$
0
0
1.安装brew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.安装git

brew install git

3.配置ssh私钥,用于拉取代码

$ cat ~/.ssh/config
Host repo1 git.foo.com
    HostName git.foo.com
    IdentityFile ~/.ssh/foo_rsa
    Port 22
Host repo2 git.bar.com
    HostName git.bar.com
    IdentityFile ~/.ssh/bar_rsa
    Port 22

4.安装gitlab-runner

sudo curl --output /usr/local/bin/gitlab-runner \
     https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64 
sudo chmod +x /usr/local/bin/gitlab-runner

5.注册gitlab-runner到Gitlab对应的项目 

gitlab-runner register --non-interactive --url " https://git.foo.com/ " --registration-token "Your Token Here" --executor "shell" --description "runner for ios development" --tag-list "shell" --run-untagged --locked="true" 

注册中需要用到Token,请用有项目Master权限的用户登陆Gitlab,在Settings→CI/CD→Runners settings下边查看
可以通过Gitlab界面查看到已经注册的runner

6.将gitlab-runner作为服务运行 
gitlab-runner作为服务运行,需要使用普通用户,并将该普通用户设置为开机自动登录。


cd ~
gitlab-runner install
gitlab-runner start


7、安装Xcode 9.1

将Xcode.app移动到 /Application中
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

======
查看系统CPU核数
system_profiler SPHardwareDataType

打开编译时间显示
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
设置编译的并行线程数
defaults write com.apple.dt.Xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 12
xcode构建的并行线程数
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 12

defaults write com.apple.dt.xcodebuild PBXNumberOfParallelBuildSubtasks 12
defaults write com.apple.dt.xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 12
数字应该是CPU的物理core数量,不过貌似默认值和改过的,只有几秒的差距,调不调都可,也许在某些机器上会有一点效果,可以自行调整比对找到最优值。

参考文档:
http://www.cl9.info/entry/2016/01/15/235114
https://blog.csdn.net/zhaoxy_thu/article/details/30073485
https://gist.github.com/nlutsenko/ee245fbd239087d22137

 

Viewing all articles
Browse latest Browse all 55

Trending Articles