parameters:
  mode: 'Debug'
  arch: 'x64'

jobs:
  - job: 'Windows_${{ parameters.mode }}_${{ parameters.arch }}'
    pool:
      vmImage: windows-2019

    steps:
    - template: setup.yml

    - task: VSBuild@1
      inputs:
        solution: 'build\win\libfly.sln'
        configuration: ${{ parameters.mode }}
        platform: ${{ parameters.arch }}
        maximumCpuCount: true
      displayName: 'Build'

    - ${{ if eq(parameters.mode, 'Release') }}:
      - task: PowerShell@2
        inputs:
          filePath: build\win\test.ps1
          arguments: -mode ${{ parameters.mode }} -arch ${{ parameters.arch }}
          failOnStderr: false
        displayName: 'Test'

      - task: PowerShell@2
        inputs:
          filePath: build\win\release.ps1
          arguments: -arch ${{ parameters.arch }}
        displayName: 'Package'

      - template: package.yml
        parameters:
          contents: 'build\win\Release\msvc\libfly-*.zip'

parameters:
  mode: 'Debug'
  arch: 'x64'

jobs:
  - job: 'Windows_${{ parameters.mode }}_${{ parameters.arch }}'
    pool:
      vmImage: windows-2019

    steps:
    - template: setup.yml

    - ${{ if eq(parameters.mode, 'Debug') }}:
      - task: VSBuild@1
        inputs:
          solution: 'build\win\libfly.sln'
          configuration: ${{ parameters.mode }}
          platform: ${{ parameters.arch }}
          maximumCpuCount: true
          msbuildArgs: /t:libfly
        displayName: 'Build'

    - ${{ if eq(parameters.mode, 'Release') }}:
      - task: VSBuild@1
        inputs:
          solution: 'build\win\libfly.sln'
          configuration: ${{ parameters.mode }}
          platform: ${{ parameters.arch }}
          maximumCpuCount: true
          msbuildArgs: /t:libfly;libfly_unit_tests
        displayName: 'Build'

      - task: PowerShell@2
        inputs:
          filePath: build\win\test.ps1
          arguments: -mode ${{ parameters.mode }} -arch ${{ parameters.arch }}
          failOnStderr: false
        displayName: 'Test'

      - task: PowerShell@2
        inputs:
          filePath: build\win\release.ps1
          arguments: -arch ${{ parameters.arch }}
        displayName: 'Package'

      - template: package.yml
        parameters:
          contents: 'build\win\Release\msvc\libfly-*.zip'

Update Windows CI to only build required targets
Update Windows CI to only build required targets
