trigger:
  branches:
    include:
    - '*'
  paths:
    exclude:      # Azure Pipelines doesn't support recursive wildcards, see
    - '.github/*' # https://developercommunity.visualstudio.com/t/support-wildcards-in-trigger-path-filters-1/366363
    - '.github/*/*'
    - '*.bat'
    - '.appveyor.yml'
    - 'doc/*/*'
    - 'doc/*'

pr:
  branches:
    include:
    - '*'
  paths:
    exclude:
    - '.github/*'
    - '.github/*/*'
    - '*.bat'
    - '.appveyor.yml'
    - 'doc/*/*'
    - 'doc/*'

pool:
  vmImage: windows-latest
strategy:
  matrix:
    Release:
      configuration: Release
    Debug:
      configuration: Debug

steps:
- pwsh: |
    echo "This CI isn't tested against master, and therefore, isn't guaranteed to work. Pull requests are welcome."
    echo "If it doesn't work and you'd rather not fix it, it's recommended to use GitHub Actions CI instead."
  displayName: Third-Party CI Warning

- checkout: self
  submodules: recursive

- pwsh: cmake -B build -A Win32
  displayName: Before build

- pwsh: cmake --build . --config $env:configuration
  workingDirectory: build
  displayName: Build

- pwsh: cmake --install . --config $env:configuration --prefix $(Build.ArtifactStagingDirectory)
  workingDirectory: build
  condition: and(succeeded(), eq(variables['configuration'], 'Release'))
  displayName: Prepare artifacts

- publish: $(Build.ArtifactStagingDirectory)
  artifact: $(configuration)
  condition: and(succeeded(), eq(variables['configuration'], 'Release'))
  displayName: Publish artifacts
