<commit_before># trigger ci builds for merged PRs into listed branches
# Setting batch to true, triggers one build at a time.
# if there is a push while a build in progress, it will wait,
# until the running build finishes, and produce a build with all the changes
trigger:
  batch: true
  branches:
    include:
    - master
    - release/3.0.0

# trigger ci builds for pull requests into listed branches
pr:
  branches:
    include:
    - master
    - release/3.0.0

variables:  
  - name: _TeamName
    value: WcfCore
  - name: _PublishUsingPipelines
    value: true
  - name: _DotNetArtifactsCategory
    value: .NETCore
  - name: _RunAsPublic
    value: true
  - name: _RunAsInternal
    value: false

  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
    - name: _RunAsPublic
      value: false
    - name: _RunAsInternal
      value: true

resources:
  containers:
  - container: ubuntu_1604_Powershell_62
    image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-coredeps-d9d81d0-20190612203614

stages:
- stage: Build
  displayName: Build
  jobs:
  - template: /eng/common/templates/jobs/jobs.yml
    parameters:
      enableMicrobuild: true
      enablePublishBuildArtifacts: true
      enablePublishBuildAssets: true
      enablePublishUsingPipelines: $(_PublishUsingPipelines)
      enableTelemetry: true
      graphFileGeneration:
        enabled: true
        includeToolset: true
      helixRepo: dotnet/wcf
      jobs:
      - job: Windows
        timeoutInMinutes: 90
        pool:
          ${{ if eq(variables._RunAsPublic, True) }}:
            name: NetCorePublic-Pool
            queue: buildpool.windows.10.amd64.vs2017.open
          ${{ if eq(variables._RunAsInternal, True) }}:
            name: NetCoreInternal-Pool
            queue: buildpool.windows.10.amd64.vs2017
        variables:
        - _InternalBuildArgs: ''
        - HelixApiAccessToken: ''
        - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true

        # Internal/Official Build Variables
        - ${{ if eq(variables._RunAsInternal, True) }}:
            # Only enable publishing in non-public, non PR scenarios.
            # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1
            # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
            # DotNet-HelixApi-Access provides: HelixApiAccessToken
            - group: DotNet-Blob-Feed
            - group: Publish-Build-Assets
            - group: DotNet-HelixApi-Access
            - _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
            - _InternalBuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
                /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
                /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl)
                /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)
                /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
                /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
                /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
            # Service uri needed for integration tests in official builds
            - _serviceUri: wcfcoresrv5.cloudapp.net/wcftestservice1

        # Public/PR & CI Build Variables
        - ${{ if eq(variables._RunAsPublic, True) }}:
            # For PR and CI test runs we use a different server machine that host multiple services to avoid concurrency issues.
            - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
            # For PR and CI test runs we need to update the Service being used by Scenario tests.
            # Used in UpdatePRService.yml
            # I think this can be removed based on the logic, setting it to true for now.
            - _updateService: true

        # Send to Helix variables
        - _xUnitWorkItemTimeout: '00:10:00'

        strategy:
          matrix:
            Release:
              _BuildConfig: Release
              # PRs or external builds are not signed.
              ${{ if eq(variables._RunAsPublic, True) }}:
                _SignType: test
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 1
              ${{ if eq(variables._RunAsInternal, True) }}:
                _SignType: real
                _DotNetPublishToBlobFeed : true
            ${{ if eq(variables._RunAsPublic, True) }}:
              Debug:
                _BuildConfig: Debug
                _SignType: test
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 2

        steps:
        - checkout: self
          clean: true
        - ${{ if eq(variables._RunAsPublic, True) }}:
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
        - script: eng\common\cibuild.cmd
            -configuration $(_BuildConfig)
            -preparemachine
            $(_InternalBuildArgs)
            $(_TestArgs)
            /p:Test=false
          displayName: Windows Build / Publish

        - powershell: eng\common\build.ps1
            -configuration $(_BuildConfig)
            -preparemachine
            -ci
            -test
            -integrationTest
            -projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
            $(_TestArgs)
            /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
          displayName: Windows - Run Helix Tests
          env:
            SYSTEM_ACCESSTOKEN: $(System.AccessToken)
            HelixAccessToken: $(HelixApiAccessToken)
            XUnitWorkItemTimeout: $(_xUnitWorkItemTimeout)
            RunAsPublic: $(_RunAsPublic)
            RunAsInternal: $(_RunAsInternal)
            IsWindowsBuild: true

      # Only build and test Unix in PR and CI builds.
      - ${{ if eq(variables._RunAsPublic, True) }}:
        - job: Linux
          timeoutInMinutes: 90
          container: ubuntu_1604_Powershell_62
          pool:
            name:  NetCorePublic-Pool
            queue: BuildPool.Ubuntu.1604.Amd64.Open
          variables:
          - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true
          - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
          - _updateService: true

          # Send to Helix variables
          - _xUnitWorkItemTimeout: '00:10:00'

          strategy:
            matrix:
              Release:
                _BuildConfig: Release
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 3
                _PublishType: none
              Debug:
                _BuildConfig: Debug
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 4
                _PublishType: none
          steps:
          - checkout: self
            clean: true
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
          - script: eng/common/cibuild.sh
              -configuration $(_BuildConfig)
              -preparemachine
              $(_TestArgs)
              /p:Test=false
            displayName: Unix Build
          - script: eng/common/build.sh
              --configuration $(_BuildConfig)
              --prepareMachine
              --ci
              --test
              --integrationTest
              --projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
              $(_TestArgs)
              /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
            displayName: Linux - Run Helix Tests
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
              ServiceHost: $(_serviceUri)
              RunAsPublic: $(_RunAsPublic)
              RunAsInternal: $(_RunAsInternal)
              IsWindowsBuild: false

      # Only build and test Unix in PR and CI builds.
      - ${{ if eq(variables._RunAsPublic, True) }}:
        - job: MacOS
          timeoutInMinutes: 90
          pool:
            name:  Hosted macOS
            queue: OSX.1013.Amd64.Open
          variables:
          - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true
          - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
          - _updateService: true

          # Send to Helix variables
          - _xUnitWorkItemTimeout: '00:10:00'

          strategy:
            matrix:
              Release:
                _BuildConfig: Release
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 5
                _PublishType: none
              Debug:
                _BuildConfig: Debug
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 6
                _PublishType: none
          steps:
          - checkout: self
            clean: true
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
          - script: eng/common/cibuild.sh
              -configuration $(_BuildConfig)
              -preparemachine
              $(_TestArgs)
              /p:Test=false
            displayName: Unix Build
          - script: eng/common/build.sh
              --configuration $(_BuildConfig)
              --prepareMachine
              --ci
              --test
              --integrationTest
              --projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
              $(_TestArgs)
              /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
            displayName: Linux - Run Helix Tests
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
              ServiceHost: $(_serviceUri)
              RunAsPublic: $(_RunAsPublic)
              RunAsInternal: $(_RunAsInternal)
              IsWindowsBuild: false

- ${{ if eq(variables._RunAsInternal, True) }}:
  - template: eng\common\templates\post-build\post-build.yml
    parameters:
      dependsOn:
      - Build
      # Symbol validation isn't being very reliable lately. This should be enabled back
      # once this issue is resolved: https://github.com/dotnet/arcade/issues/2871
      enableSymbolValidation: false
      # Sourcelink validation isn't passing for Arcade due to some regressions. This should be
      # enabled back once this issue is resolved: https://github.com/dotnet/arcade/issues/2912
      enableSourceLinkValidation: false
      # This is to enable SDL runs part of Post-Build Validation Stage
      SDLValidationParameters:
        enable: true
        params: ' -SourceToolsList @("policheck","credscan")
        -TsaInstanceURL "https://devdiv.visualstudio.com/"
        -TsaProjectName "DEVDIV"
        -TsaNotificationEmail "<EMAIL>"
        -TsaCodebaseAdmin "REDMOND\stebon"
        -TsaBugAreaPath "DevDiv\NET\NET Core"
        -TsaIterationPath "DevDiv"
        -TsaRepositoryName "WCF"
        -TsaCodebaseName "WCF"
        -TsaPublish $True'
<commit_msg>Update parameter used to trigger 'post-build.yml'.<commit_after># trigger ci builds for merged PRs into listed branches
# Setting batch to true, triggers one build at a time.
# if there is a push while a build in progress, it will wait,
# until the running build finishes, and produce a build with all the changes
trigger:
  batch: true
  branches:
    include:
    - master
    - release/3.0.0

# trigger ci builds for pull requests into listed branches
pr:
  branches:
    include:
    - master
    - release/3.0.0

variables:  
  - name: _TeamName
    value: WcfCore
  - name: _PublishUsingPipelines
    value: true
  - name: _DotNetArtifactsCategory
    value: .NETCore
  - name: _RunAsPublic
    value: true
  - name: _RunAsInternal
    value: false

  - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
    - name: _RunAsPublic
      value: false
    - name: _RunAsInternal
      value: true

resources:
  containers:
  - container: ubuntu_1604_Powershell_62
    image: mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-coredeps-d9d81d0-20190612203614

stages:
- stage: Build
  displayName: Build
  jobs:
  - template: /eng/common/templates/jobs/jobs.yml
    parameters:
      enableMicrobuild: true
      enablePublishBuildArtifacts: true
      enablePublishBuildAssets: true
      enablePublishUsingPipelines: $(_PublishUsingPipelines)
      enableTelemetry: true
      graphFileGeneration:
        enabled: true
        includeToolset: true
      helixRepo: dotnet/wcf
      jobs:
      - job: Windows
        timeoutInMinutes: 90
        pool:
          ${{ if eq(variables._RunAsPublic, True) }}:
            name: NetCorePublic-Pool
            queue: buildpool.windows.10.amd64.vs2017.open
          ${{ if eq(variables._RunAsInternal, True) }}:
            name: NetCoreInternal-Pool
            queue: buildpool.windows.10.amd64.vs2017
        variables:
        - _InternalBuildArgs: ''
        - HelixApiAccessToken: ''
        - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true

        # Internal/Official Build Variables
        - ${{ if eq(variables._RunAsInternal, True) }}:
            # Only enable publishing in non-public, non PR scenarios.
            # DotNet-Blob-Feed provides: dotnetfeed-storage-access-key-1
            # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
            # DotNet-HelixApi-Access provides: HelixApiAccessToken
            - group: DotNet-Blob-Feed
            - group: Publish-Build-Assets
            - group: DotNet-HelixApi-Access
            - _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json
            - _InternalBuildArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
                /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1)
                /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl)
                /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed)
                /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
                /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory)
                /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
            # Service uri needed for integration tests in official builds
            - _serviceUri: wcfcoresrv5.cloudapp.net/wcftestservice1

        # Public/PR & CI Build Variables
        - ${{ if eq(variables._RunAsPublic, True) }}:
            # For PR and CI test runs we use a different server machine that host multiple services to avoid concurrency issues.
            - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
            # For PR and CI test runs we need to update the Service being used by Scenario tests.
            # Used in UpdatePRService.yml
            # I think this can be removed based on the logic, setting it to true for now.
            - _updateService: true

        # Send to Helix variables
        - _xUnitWorkItemTimeout: '00:10:00'

        strategy:
          matrix:
            Release:
              _BuildConfig: Release
              # PRs or external builds are not signed.
              ${{ if eq(variables._RunAsPublic, True) }}:
                _SignType: test
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 1
              ${{ if eq(variables._RunAsInternal, True) }}:
                _SignType: real
                _DotNetPublishToBlobFeed : true
            ${{ if eq(variables._RunAsPublic, True) }}:
              Debug:
                _BuildConfig: Debug
                _SignType: test
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 2

        steps:
        - checkout: self
          clean: true
        - ${{ if eq(variables._RunAsPublic, True) }}:
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
        - script: eng\common\cibuild.cmd
            -configuration $(_BuildConfig)
            -preparemachine
            $(_InternalBuildArgs)
            $(_TestArgs)
            /p:Test=false
          displayName: Windows Build / Publish

        - powershell: eng\common\build.ps1
            -configuration $(_BuildConfig)
            -preparemachine
            -ci
            -test
            -integrationTest
            -projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
            $(_TestArgs)
            /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
          displayName: Windows - Run Helix Tests
          env:
            SYSTEM_ACCESSTOKEN: $(System.AccessToken)
            HelixAccessToken: $(HelixApiAccessToken)
            XUnitWorkItemTimeout: $(_xUnitWorkItemTimeout)
            RunAsPublic: $(_RunAsPublic)
            RunAsInternal: $(_RunAsInternal)
            IsWindowsBuild: true

      # Only build and test Unix in PR and CI builds.
      - ${{ if eq(variables._RunAsPublic, True) }}:
        - job: Linux
          timeoutInMinutes: 90
          container: ubuntu_1604_Powershell_62
          pool:
            name:  NetCorePublic-Pool
            queue: BuildPool.Ubuntu.1604.Amd64.Open
          variables:
          - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true
          - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
          - _updateService: true

          # Send to Helix variables
          - _xUnitWorkItemTimeout: '00:10:00'

          strategy:
            matrix:
              Release:
                _BuildConfig: Release
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 3
                _PublishType: none
              Debug:
                _BuildConfig: Debug
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 4
                _PublishType: none
          steps:
          - checkout: self
            clean: true
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
          - script: eng/common/cibuild.sh
              -configuration $(_BuildConfig)
              -preparemachine
              $(_TestArgs)
              /p:Test=false
            displayName: Unix Build
          - script: eng/common/build.sh
              --configuration $(_BuildConfig)
              --prepareMachine
              --ci
              --test
              --integrationTest
              --projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
              $(_TestArgs)
              /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
            displayName: Linux - Run Helix Tests
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
              ServiceHost: $(_serviceUri)
              RunAsPublic: $(_RunAsPublic)
              RunAsInternal: $(_RunAsInternal)
              IsWindowsBuild: false

      # Only build and test Unix in PR and CI builds.
      - ${{ if eq(variables._RunAsPublic, True) }}:
        - job: MacOS
          timeoutInMinutes: 90
          pool:
            name:  Hosted macOS
            queue: OSX.1013.Amd64.Open
          variables:
          - _TestArgs: /p:ServiceUri=$(_serviceUri) /p:Root_Certificate_Installed=true /p:Client_Certificate_Installed=true /p:SSL_Available=true
          - _serviceUri: wcfcoresrv2.cloudapp.net/WcfService$(_WcfPRServiceId)
          - _updateService: true

          # Send to Helix variables
          - _xUnitWorkItemTimeout: '00:10:00'

          strategy:
            matrix:
              Release:
                _BuildConfig: Release
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 5
                _PublishType: none
              Debug:
                _BuildConfig: Debug
                _SignType: none
                _DotNetPublishToBlobFeed : false
                _WcfPRServiceId: 6
                _PublishType: none
          steps:
          - checkout: self
            clean: true
          - template: /eng/UpdatePRService.yml
            parameters:
              wcfPRServiceId: $(_WcfPRServiceId)
          - script: eng/common/cibuild.sh
              -configuration $(_BuildConfig)
              -preparemachine
              $(_TestArgs)
              /p:Test=false
            displayName: Unix Build
          - script: eng/common/build.sh
              --configuration $(_BuildConfig)
              --prepareMachine
              --ci
              --test
              --integrationTest
              --projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
              $(_TestArgs)
              /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
            displayName: Linux - Run Helix Tests
            env:
              SYSTEM_ACCESSTOKEN: $(System.AccessToken)
              ServiceHost: $(_serviceUri)
              RunAsPublic: $(_RunAsPublic)
              RunAsInternal: $(_RunAsInternal)
              IsWindowsBuild: false

- ${{ if eq(variables._RunAsInternal, True) }}:
  - template: eng\common\templates\post-build\post-build.yml
    parameters:
      validateDependsOn:
      - Build
      # Symbol validation isn't being very reliable lately. This should be enabled back
      # once this issue is resolved: https://github.com/dotnet/arcade/issues/2871
      enableSymbolValidation: false
      # Sourcelink validation isn't passing for Arcade due to some regressions. This should be
      # enabled back once this issue is resolved: https://github.com/dotnet/arcade/issues/2912
      enableSourceLinkValidation: false
      # This is to enable SDL runs part of Post-Build Validation Stage
      SDLValidationParameters:
        enable: true
        params: ' -SourceToolsList @("policheck","credscan")
        -TsaInstanceURL "https://devdiv.visualstudio.com/"
        -TsaProjectName "DEVDIV"
        -TsaNotificationEmail "<EMAIL>"
        -TsaCodebaseAdmin "REDMOND\stebon"
        -TsaBugAreaPath "DevDiv\NET\NET Core"
        -TsaIterationPath "DevDiv"
        -TsaRepositoryName "WCF"
        -TsaCodebaseName "WCF"
        -TsaPublish $True'

{'fraction_non_alphanumeric': 0.0836217092294888, 'fraction_numerical': 0.009987296859257961, 'mean_word_length': 1.8742288807755256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7455855', 'n_tokens_mistral': 6571, 'n_tokens_neox': 6242, 'n_words': 1387}