Ios 如何在gitlab ci中安装brew

Ios 如何在gitlab ci中安装brew,ios,yaml,gitlab-ci,Ios,Yaml,Gitlab Ci,如何使用shell在gitlab ci中安装brew # - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" 这不能保证安装成功 这是my.gitlab-ci.yml文件

如何使用shell在gitlab ci中安装brew

# - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
# - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
这不能保证安装成功

这是my.gitlab-ci.yml文件代码

stages:
  - build
  - archive

before_script:
- gem install cocoapods
# - pod install


build_project:
  stage: build
  script: 
    # - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
    # - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"


    # - curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install
    - curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install
    - PATH=/usr/local/bin:$PATH

    - brew install xctool
    - xctool -project cicdios.xcodeproj -scheme cicdios clean
    - xctool -project cicdios.xcodeproj -scheme cicdios test -test-sdk iphonesimulator9.3

archive_project:
  stage: archive
  script: 
    - xctool -project cicdios.xcodeproj -scheme cicdios archive -archivePath build/cicdios
    - xcodebuild -exportArchive -exportFormat ipa -archivePath "build/cicdios.xcarchive" -exportPath "build/cicdios.ipa"
  only: 
    - master
  artifacts:
    paths:
      - build/cicdios.ipa
我想在gitlab ci中构建项目,但这个yml需要安装xctool,所以如果我安装xctool,就必须安装brew,但我不知道如何在这个版本中安装brew

stages:
  - build
  - archive

before_script:
- gem install cocoapods
# - pod install


build_project:
  stage: build
  script: 
    # - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
    # - sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"


    # - curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install
    - curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install
    - PATH=/usr/local/bin:$PATH

    - brew install xctool
    - xctool -project cicdios.xcodeproj -scheme cicdios clean
    - xctool -project cicdios.xcodeproj -scheme cicdios test -test-sdk iphonesimulator9.3

archive_project:
  stage: archive
  script: 
    - xctool -project cicdios.xcodeproj -scheme cicdios archive -archivePath build/cicdios
    - xcodebuild -exportArchive -exportFormat ipa -archivePath "build/cicdios.xcarchive" -exportPath "build/cicdios.ipa"
  only: 
    - master
  artifacts:
    paths:
      - build/cicdios.ipa