如何使用COCOAPODS减少CircleCI上iOS项目的编译时间

NDM*_*DEV 8 continuous-integration build ios cocoapods circleci

我正在开发的iOS应用程序使用CircleCI进行自动测试和更多CI操作.我们确实让它在CircleCI上编译并运行,但编译时间大约需要9分钟.我需要以某种方式减少编译时间.我想了几个选择:

  1. 使用框架而不是CocoaPods.当pod正在下载并安装在CircleCi上时.
  2. 在Cocoa pod上使用一些缓存 - 我们试试没有运气(请参阅下面的YML代码).
  3. 让编译器只编译代码中所做的更改 - 这是朋友的建议,我找不到任何关于它的东西.

YML代码的一部分:

# Specify the Xcode version to use
macos:
  xcode: "9.2.0"
shell: /bin/bash --login -eo pipefail

steps:
  - checkout
  - run: git submodule sync
  - run: git submodule update --init --remote
  - run:

      name: Set Ruby Version
      command: echo "ruby-2.4" > ~/.ruby-version

  - restore_cache:
      key: 1-gems-{{ checksum "Gemfile.lock" }}

  - run: bundle check || bundle install --path vendor/bundle

  - save_cache:
      key: 1-gems-{{ checksum "Gemfile.lock" }}
      paths:
        - vendor/bundle

  - restore_cache:
      key: 1-pods-{{ checksum "Podfile.lock" }}
  - run:
      name: Install CocoaPods
      command: |
        curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf
        bundle exec pod install
  - save_cache:
      key: 1-pods-{{ checksum "Podfile.lock" }}
      paths:
        - ./Pods

  # Build the app
  - run:
      name: Build app
      command: |
        export LC_ALL=en_US.UTF-8
        export LANG=en_US.UTF-8
        bundle exec fastlane match adhoc
        bundle exec fastlane adhoc

  # uploading app to testobject
  - run:
      name: Upload app
      command: |
        curl -u user -X POST https://testobject.com:443/api/storage/upload -H "Content-Type: application/octet-stream" --data-binary @./builds/app.ipa
Run Code Online (Sandbox Code Playgroud)

pod文件:

pod 'OpenCV2' // Problem transforming to framework as it is too large for github
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'Fabric', '~> 1.7.2'
pod 'Crashlytics', '~> 3.9.3'
pod 'Apollo' // MATBE this can be a framework too
pod 'SwiftyJSON' // This can be a framework
pod 'RealmSwift', // This can be a framework
pod 'Kingfisher', '~> 4.0'
pod 'Hero'
pod 'MaterialComponents/TextFields'
pod 'MaterialComponents/AppBar'
pod 'Material', '~> 2.0'
Run Code Online (Sandbox Code Playgroud)

有关如何减少构建时间的任何建议?