jobs:
- job: macOS
  pool:
    vmImage: xcode9-macos10.13
  steps:
    - bash: |
        set -e
        sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer
        brew update-reset
        ln -s "$PWD" "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle"
        brew style homebrew/bundle
        bundle install
        bundle exec rake
      displayName: Tests
      env:
        COVERALLS_REPO_TOKEN: $(coveralls.homebrewBundleApiToken)

    - task: PublishCodeCoverageResults@1
      displayName: Publish code coverage
      inputs:
        codeCoverageTool: Cobertura
        summaryFileLocation: $(Build.SourcesDirectory)/coverage/coverage.xml
        reportDirectory: $(Build.SourcesDirectory)/coverage
        failIfCoverageEmpty: true
