version: 2
jobs:
  build-and-test:
    macos:
      xcode: "10.1.0"

    steps:
      - checkout
      - run:
          name: Save Xcode version
          command: xcodebuild -version > .circle-xcode-version
      - run:
          name: Pre-fetch CocoaPods specs
          command: |
            curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf

      - restore_cache:
          keys:
            - cocoapods-{{ checksum "Podfile.lock" }}
            - cocoapods-
      - restore_cache:
          keys:
            - carthage-{{ checksum ".circle-xcode-version" }}-{{ checksum "Cartfile.resolved" }}
            - carthage-{{ checksum ".circle-xcode-version" }}
            - carthage-

      - run: bin/setup

      - save_cache:
          key: cocoapods-{{ checksum "Podfile.lock" }}
          paths:
            - "Pods"
      - save_cache:
          key: carthage-{{ checksum ".circle-xcode-version" }}-{{ checksum "Cartfile.resolved" }}
          paths:
            - "~/Library/Caches/org.carthage.CarthageKit"
            - "Carthage"

      - run: bin/test
      - run: bin/archive

workflows:
  version: 2
  build-and-test:
    jobs:
      - build-and-test

version: 2
jobs:
  build-and-test:
    macos:
      xcode: "10.1.0"

    steps:
      - checkout
      - run:
          name: Save Xcode version
          command: xcodebuild -version | tee .circle-xcode-version
      - run:
          name: Pre-fetch CocoaPods specs
          command: |
            curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf

      - restore_cache:
          keys:
            - cocoapods-{{ checksum "Podfile.lock" }}
            - cocoapods-
      - restore_cache:
          keys:
            - carthage-{{ checksum ".circle-xcode-version" }}-{{ checksum "Cartfile.resolved" }}
            - carthage-{{ checksum ".circle-xcode-version" }}
            - carthage-

      - run: bin/setup

      - save_cache:
          key: cocoapods-{{ checksum "Podfile.lock" }}
          paths:
            - "Pods"
      - save_cache:
          key: carthage-{{ checksum ".circle-xcode-version" }}-{{ checksum "Cartfile.resolved" }}
          paths:
            - "~/Library/Caches/org.carthage.CarthageKit"
            - "Carthage"

      - run: bin/test
      - run: bin/archive

workflows:
  version: 2
  build-and-test:
    jobs:
      - build-and-test

Print xcodebuild version to stdout on CI
Print xcodebuild version to stdout on CI
