# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

# Azure pipeline
# We use it to cover windows and mac build
# Jenkins is still the primary CI

name: $(Date:yyyyMMdd)$(Rev:.r)
jobs:
  - job: Windows_VS2017_x86
    pool:
      vmImage: 'vs2017-win2016'
    steps:
    - script: git submodule update --recursive --init
      displayName: Initialize submodules
    - script: mkdir build.common
      displayName: Make Build Directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build.common'
        cmakeArgs: >
          -DUSE_SORT=ON
          -DUSE_RPC=ON
          -DUSE_GRAPH_RUNTIME=ON
          ..
    - task: MSBuild@1
      inputs:
        solution: 'build.common/ALL_BUILD.vcxproj'
        maximumCpuCount: true
        configuration: 'Debug'
  - job: Windows_VS2017_x64
    pool:
      vmImage: 'vs2017-win2016'
    steps:
    - script: git submodule update --recursive --init
      displayName: Initialize submodules
    - script: mkdir build.common
      displayName: Make Build Directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build.common'
        cmakeArgs: >
          -DUSE_SORT=ON
          -DUSE_RPC=ON
          -DUSE_GRAPH_RUNTIME=ON
          ..
    - task: MSBuild@1
      inputs:
        solution: 'build.common/ALL_BUILD.vcxproj'
  - job: MacOS_XCode9
    pool:
      vmImage: 'xcode9-macos10.13'
    steps:
    - script: git submodule update --recursive --init
      displayName: Initialize submodules
    - script: mkdir build.common
      displayName: Make Build Directory
    - task: CMake@1
      inputs:
        workingDirectory: 'build.common'
        cmakeArgs: >
          -DUSE_SORT=ON
          -DUSE_RPC=ON
          -DUSE_GRAPH_RUNTIME=ON
          ..
    - script: cd build.common && make -j`sysctl -n hw.ncpu`
      displayName: Build the project