name: PR-$(System.PullRequest.PullRequestNumber)-$(Date:yyyyMMdd)$(Rev:.rr)
trigger:
  # Batch merge builds together while a merge build is running
  batch: true
  branches:
    include:
    - master
    - release*
    - feature*
  paths:
    exclude:
      - tests/*
      - docs/*
      - demos/*
      - CHANGELOG/*
      - .devcontainer/*
      - .github/*
      - .poshchan/*
      - .vscode/*
      - code-server/*
      - docker/*

pr:
  branches:
    include:
    - master
    - release*
    - feature*
  paths:
    # file extension filters are not supported when this was written.
    # This really should be /src/**/*.csproj
    include:
    - .vsts-ci/windows/*
    - assets/wix/*
    - build.psm1
    - global.json
    - nuget.config
    - PowerShell.Common.props
    - src/Microsoft.Management.Infrastructure.CimCmdlets/Microsoft.Management.Infrastructure.CimCmdlets.csproj
    - src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj
    - src/Microsoft.PowerShell.Commands.Diagnostics/Microsoft.PowerShell.Commands.Diagnostics.csproj
    - src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj
    - src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj
    - src/Microsoft.PowerShell.ConsoleHost/Microsoft.PowerShell.ConsoleHost.csproj
    - src/Microsoft.PowerShell.CoreCLR.Eventing/Microsoft.PowerShell.CoreCLR.Eventing.csproj
    - src/Microsoft.PowerShell.GlobalTool.Shim/Microsoft.PowerShell.GlobalTool.Shim.csproj
    - src/Microsoft.PowerShell.MarkdownRender/Microsoft.PowerShell.MarkdownRender.csproj
    - src/Microsoft.PowerShell.SDK/Microsoft.PowerShell.SDK.csproj
    - src/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.csproj
    - src/Microsoft.WSMan.Management/Microsoft.WSMan.Management.csproj
    - src/Microsoft.WSMan.Runtime/Microsoft.WSMan.Runtime.csproj
    - src/Modules/PSGalleryModules.csproj
    - src/powershell-win-core/powershell-win-core.csproj
    - tools/ci.psm1
    - tools/packaging/*

variables:
  - name: GIT_CONFIG_PARAMETERS
    value: "'core.autocrlf=false'"
  - name: DOTNET_CLI_TELEMETRY_OPTOUT
    value: 1
  - name: POWERSHELL_TELEMETRY_OPTOUT
    value: 1
  # Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds
  - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
    value: 1
  - name: __SuppressAnsiEscapeSequences
    value: 1
  - group: fakeNugetKey

resources:
- repo: self
  clean: true
stages:
- stage: PackagingWin
  displayName: Packaging for Windows
  dependsOn: [] # by specifying an empty array, this stage doesn't depend on the stage before it
  jobs:
  # Unlike daily builds, we do not upload nuget package to MyGet so we do not wait on tests to finish.
  - template: templates/windows-packaging.yml
  - template: templates/windows-packaging.yml
    parameters:
      channel: stable
      architecture: x86
  - template: templates/windows-packaging.yml
    parameters:
      channel: preview
      architecture: x86
