trigger:
  branches:
    include:
    - '*'
pr:
  branches:
    include:
    - '*'
stages:
- stage:
  variables:
    CONFIGURATION: Release
  jobs:
  - job:
    pool:
      vmImage: windows-2019
    workspace:
      clean: all
    timeoutInMinutes: 120
    strategy:
      matrix:
        Provider_NET_FB30:
          FIREBIRD_SELECTION: FB30
          TEST_SUITE: Tests-FirebirdClient-NET
        Provider_Core_FB30:
          FIREBIRD_SELECTION: FB30
          TEST_SUITE: Tests-FirebirdClient-Core
        Provider_NET_FB25:
          FIREBIRD_SELECTION: FB25
          TEST_SUITE: Tests-FirebirdClient-NET
        Provider_Core_FB25:
          FIREBIRD_SELECTION: FB25
          TEST_SUITE: Tests-FirebirdClient-Core
        EFCore_FB30:
          FIREBIRD_SELECTION: FB30
          TEST_SUITE: Tests-EFCore
        EFCore_FB25:
          FIREBIRD_SELECTION: FB25
          TEST_SUITE: Tests-EFCore
        EF6_FB30:
          FIREBIRD_SELECTION: FB30
          TEST_SUITE: Tests-EF6
        EF6_FB25:
          FIREBIRD_SELECTION: FB25
          TEST_SUITE: Tests-EF6
    steps:
    - script: |
       choco install 7zip --yes
       choco install wixtoolset --version 3.11.1 --yes
      displayName: Chocolatey

    - powershell: |
       try {
         $env:PATH += ';C:\Program Files\7-Zip'
         $env:build_wix = 'C:\Program Files (x86)\WiX Toolset v3.11\bin'

         .\Provider\build.ps1 -Configuration $env:CONFIGURATION
         exit $LASTEXITCODE
       }
       catch {
         echo $_
         exit 1
       }
      displayName: Build

    - powershell: |
       try {
         $env:PATH += ';C:\Program Files\7-Zip'
         $env:tests_firebird_dir = 'C:\firebird'

         .\Provider\tests.ps1 -Configuration $env:CONFIGURATION -FirebirdSelection $env:FIREBIRD_SELECTION -TestSuite $env:TEST_SUITE
         exit $LASTEXITCODE
       }
       catch {
         exit 1
       }
      displayName: Tests

    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact'
      inputs:
        PathtoPublish: '.\\Provider\\out\\'
