version: 2

jobs:
  build-and-test:
    environment:
      BUNDLE_PATH: vendor/bundle
      FL_OUTPUT_DIR: output
    macos:
      xcode: "9.4.1"
    working_directory: ~/VimeoNetworking
    shell: /bin/bash --login -o pipefail
    
    steps:
      - checkout
      
      - restore_cache:
          key: v1-gems-{{ checksum "Gemfile.lock" }}

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

      - run: 
          name: Install bundler dependencies
          command: bundle install --path vendor/bundle

      - run: 
          name: Build and run iOS tests
          command: bundle exec fastlane scan
          environment:
            SCAN_DEVICE: iPhone 8
            SCAN_SCHEME: VimeoNetworkingExample-iOS

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

      - store_artifacts:
          path: output

      - store_test_results:
          path: output/scan

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

jobs:
  build-and-test:
    environment:
      BUNDLE_PATH: vendor/bundle
      FL_OUTPUT_DIR: output
    macos:
      xcode: "10.0.0"
    working_directory: ~/VimeoNetworking
    shell: /bin/bash --login -o pipefail
    
    steps:
      - checkout
      
      - restore_cache:
          key: v1-gems-{{ checksum "Gemfile.lock" }}

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

      - run: 
          name: Install bundler dependencies
          command: bundle install --path vendor/bundle

      - run: 
          name: Build and run iOS tests
          command: bundle exec fastlane ios test
          environment:
            SCAN_DEVICE: iPhone 8
            SCAN_SCHEME: VimeoNetworkingExample-iOS

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

      - store_artifacts:
          path: output

      - store_test_results:
          path: output/scan

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

Update CircleCI to build against Xcode 10
Update CircleCI to build against Xcode 10
