# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
trigger:
  batch: true
  branches:
    include:
      - main
      - feature/*
      - release/*
      - hotfix/*
  paths:
    include:
      - sdk/eventhubs

pr:
  branches:
    include:
      - main
      - feature/*
      - release/*
      - hotfix/*
  paths:
    include:
      - sdk/eventhubs
      - eng/common/testproxy

extends:
    template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml
    parameters:
      ServiceDirectory: eventhubs
      CtestRegex: "azure-messaging-eventhubs.*"
      LiveTestCtestRegex: "azure-messaging-eventhubs.*"
      LiveTestTimeoutInMinutes: 120
      LineCoverageTarget: 27
      BranchCoverageTarget: 13
      Artifacts:
        - Name: azure-messaging-eventhubs
          Path: azure-messaging-eventhubs
          VcpkgPortName: azure-messaging-eventhubs-cpp
        - Name: azure-messaging-eventhubs-checkpointstore-blob
          Path: azure-messaging-eventhubs-checkpointstore-blob
          VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp
      ArtifactsSource:
        - Name: azure-messaging-eventhubs
          Path: azure-messaging-eventhubs
          VcpkgPortName: azure-messaging-eventhubs-cpp
        - Name: azure-messaging-eventhubs-checkpointstore-blob
          Path: azure-messaging-eventhubs-checkpointstore-blob
          VcpkgPortName: azure-messaging-eventhubs-checkpointstore-blob-cpp
      TestEnv:
        - Name: AZURE_TENANT_ID
          Value: "33333333-3333-3333-3333-333333333333"
        - Name: AZURE_CLIENT_ID
          Value: "non-real-client"
        - Name: AZURE_CLIENT_SECRET
          Value: "non-real-secret"
        - Name: AZURE_SUBSCRIPTION_ID
          Value: "non-real-sub"
        - Name: EVENTHUB_CONSUMER_GROUP
          Value: "defaultgroup"
        - Name: EVENTHUB_NAME
          Value: "non-real-eventhub-name"
        - Name: CHECKPOINTSTORE_STORAGE_URL
          Value: "https://non-real-account.blob.core.windows.net"
        - Name: EVENTHUB_CONNECTION_STRING
          Value: "Endpoint=sb://notReal.servicebus.windows.net/;SharedAccessKeyName=notReal"
        - Name: CHECKPOINTSTORE_STORAGE_CONNECTION_STRING
          Value: "DefaultEndpointsProtocol=https;AccountName=notReal;AccountKey=3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333;EndpointSuffix=core.windows.net"

      CMakeTestOptions:
        - Name: Default
          Value: ''
        - Name: Test
          Value: '-DBUILD_TESTING=ON'
        - Name: Samples
          Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON'
        - Name: Performance
          Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON'
      CMakeSourceTestOptions:
        - Name: Source
  # FETCH_SOURCE_DEPS is disabled because azure-messaging-eventhubs is not present in the vcpkg catalog at the current Azure SDK baseline commit.
  # Disabling DISABLE_AZURE_CORE_OPENTELEMETRY because eventhubs does not have a dependency on azure-core-opentelemetry, but azure core includes 
  # azure-core-opentelemetry in builds unless disabled.
          Value: '-DFETCH_SOURCE_DEPS=OFF -DDISABLE_AZURE_CORE_OPENTELEMETRY=ON'
