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:
    include:
    - '*'
    exclude:
    - /tools/releaseBuild/**/*
    - /.vsts-ci/misc-analysis.yml
    - /.github/ISSUE_TEMPLATE/*
    - /.dependabot/config.yml
pr:
  branches:
    include:
    - master
    - release*
    - feature*
  paths:
    include:
    - '*'
    exclude:
    - /tools/releaseBuild/**/*
    - /.vsts-ci/misc-analysis.yml
    - /.github/ISSUE_TEMPLATE/*
    - /.dependabot/config.yml

variables:
  DOTNET_CLI_TELEMETRY_OPTOUT: 1
  POWERSHELL_TELEMETRY_OPTOUT: 1
  # Avoid expensive initialization of dotnet cli, see: https://donovanbrown.com/post/Stop-wasting-time-during-NET-Core-builds
  DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
  # Turn off Homebrew analytics
  HOMEBREW_NO_ANALYTICS: 1

resources:
- repo: self
  clean: true
jobs:
- template: templates/ci-build.yml
  parameters:
    pool: Hosted macOS
    jobName: mac_build
    displayName: macOS Build

- template: templates/nix-test.yml
  parameters:
    purpose: UnelevatedPesterTests
    tagSet: CI
    parentJobs:
      - mac_build

- template: templates/nix-test.yml
  parameters:
    purpose: ElevatedPesterTests
    tagSet: CI
    parentJobs:
      - mac_build

- template: templates/nix-test.yml
  parameters:
    purpose: UnelevatedPesterTests
    tagSet: Others
    parentJobs:
      - mac_build

- template: templates/nix-test.yml
  parameters:
    purpose: ElevatedPesterTests
    tagSet: Others
    parentJobs:
      - mac_build

- template: templates/verify-xunit.yml
  parameters:
    pool: 'Hosted macOS'
    parentJobs:
      - mac_build

- job: CodeCovTestPackage
  displayName: CodeCoverage and Test Packages
  steps:
  - powershell: |
      Import-Module .\tools\ci.psm1
      New-CodeCoverageAndTestPackage
    displayName: CodeCoverage and Test Package
