如何在Circle CI 2.0上为Xcode项目升级ruby版本?

时间:2019-04-26 00:21:45

标签: ruby circleci

我坐在config.yml和.ruby版本中以升级ruby。

但是我收到一条错误消息unknown Ruby: ruby-2.6.2

它使用ruby-2.3,并且没有问题。

如何使用config.yml设置ruby 2.6.2?

config.yml

defaults: &defaults
    macos:
      xcode: "10.0"
    shell: /bin/bash --login -eo pipefail
aliases:
  - &prepare
    | 
      git submodule update --init --recursive
      gem install bundler
      bundle install
  - &filter-only-master
    branches:
      only:
        - master

version: 2
jobs:
  ios:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:ios
      - run: bash <(curl -s https://codecov.io/bash)
      - store_test_results:
          path: build/reports
  macos:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:macos
      - run: bash <(curl -s https://codecov.io/bash)
      - store_test_results:
          path: build/reports
  facebook_utils:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:facebook_utils:ios
      - run: bash <(curl -s https://codecov.io/bash)
      - store_test_results:
          path: build/reports
  twitter_utils:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:twitter_utils:ios
      - run: bash <(curl -s https://codecov.io/bash)
      - store_test_results:
          path: build/reports
  parseui:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:parseui:all
  deployment:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: |
            xcrun simctl create "Apple TV 1080p" com.apple.CoreSimulator.SimDeviceType.Apple-TV-1080p com.apple.CoreSimulator.SimRuntime.tvOS-11-0
            bundle exec rake package:release
  jazzy:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: ./Scripts/jazzy.sh
  carthage:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:carthage
  cocoapods:
    <<: *defaults
    steps:
      - checkout
      - run: *prepare
      - run: bundle exec rake test:cocoapods

workflows:
  version: 2
  pr:
    jobs:
      - ios
      - macos
      - facebook_utils
      - twitter_utils
      - parseui
      - jazzy
  nightly:
    jobs:
      - deployment
      - cocoapods:
          requires:
            - deployment
      - carthage:
          requires:
            - deployment
    triggers:
      - schedule:
          cron: "0 1 * * *"
          filters: *filter-only-master

.ruby版本

ruby-2.6.2

我在下面收到一条错误消息

#!/bin/bash --login -eo pipefail
git submodule update --init --recursive
gem install bundler
bundle install
^D^Dchruby: unknown Ruby: ruby-2.6.2
Exited with code 1

1 个答案:

答案 0 :(得分:1)

在CircleCI 2.0中,您需要检查与特定macOS container image一起使用的红宝石版本。

  

我们的macOS容器包含多个Ruby版本。默认版本是系统安装的Ruby。容器在构建时还包括Ruby的最新稳定版本。我们使用Ruby-Lang.org下载页面确定Ruby的稳定版本。每个容器的软件清单中列出了每个映像中安装的Ruby版本。   https://circleci.com/docs/2.0/testing-ios/#using-custom-ruby-versions

由于您是在Xcode 10中构建的,因此chruby可以使用macOS容器映像10.0.0: Xcode 10.0 (Build 10A255),ruby版本2.3.7、2.4.4、2.5.1。