<commit_before>pool:
  vmImage: 'windows-latest'

variables:
  - name: "Build.ArtifactStagingDirectory"
    value: "Artifacts/"
  - name: "buildPlatform"
    value: "x64"
  # The following variables are defined as settable at queue time, so they cannot be included here
  # Branch.CdfProvider: dnn
  # Branch.CkEditor: development
  # CakeTarget: BuildAll
  # ReleaseMode: Beta
  # RunTests: True

trigger:
  batch: true
  branches:
    include:
      - '*'

pr:
  autoCancel: true
  branches:
    include:
      - '*'

steps:

- task: PowerShell@2
  displayName: 'Run DNN Update Versions'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=BuildServerSetVersion'

- script: 'sqllocaldb start mssqllocaldb'
  displayName: 'Start Sql LocalDb Service'
  condition: and(succeeded(), eq(variables['RunTests'], 'True'))

- powershell: 'npm config set registry https://www.myget.org/F/dnn-software-public/npm/'
  displayName: 'npm config set registry'
  enabled: false

- powershell: |
   $path = '.\DNN Platform\Library\Properties\AssemblyInfo.cs'
   $pattern3 = '\[assembly: AssemblyStatus'
   (Get-Content $path) | ForEach-Object{
      if($_ -match $pattern3){
       # We have found the matching line
       '[assembly: AssemblyStatus(ReleaseMode.{0})]' -f '$(ReleaseMode)'
      } else {
       $_
      }
     } | Set-Content $path
   
  displayName: 'Update Alpha/Beta/Stable flag'

- task: PowerShell@2
  displayName: 'Run DNN Build via Cake'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=$(CakeTarget) --verbosity=diagnostic --CkBranch="$(Branch.CkEditor)" --CdfBranch="$(Branch.CdfProvider)"'

- task: PowerShell@2
  displayName: 'Run Unit Tests via Cake'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=UnitTests --verbosity=diagnostic'
  continueOnError: true
  condition: and(succeeded(), eq(variables['RunTests'], 'True'))

- task: PublishTestResults@2
  displayName: 'Publish Test Results **/TestResults/*.xml'
  inputs:
    testResultsFormat: VSTest
    testResultsFiles: '**/TestResults/*.xml'
    mergeTestResults: true<commit_msg>Use variable for cake verbosity<commit_after>pool:
  vmImage: 'windows-latest'

variables:
  - name: "Build.ArtifactStagingDirectory"
    value: "Artifacts/"
  # The following variables are defined as settable at queue time, so they cannot be included here
  # Branch.CdfProvider: dnn
  # Branch.CkEditor: development
  # CakeTarget: BuildAll
  # CakeVerbosity: Normal # valid values include Quiet, Minimal, Normal, Verbose, Diagnostic
  # ReleaseMode: Beta
  # RunTests: True

trigger:
  batch: true
  branches:
    include:
      - '*'

pr:
  autoCancel: true
  branches:
    include:
      - '*'

steps:

- task: PowerShell@2
  displayName: 'Run DNN Update Versions'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=BuildServerSetVersion --verbosity=$(CakeVerbosity)'

- script: 'sqllocaldb start mssqllocaldb'
  displayName: 'Start Sql LocalDb Service'
  condition: and(succeeded(), eq(variables['RunTests'], 'True'))

- powershell: 'npm config set registry https://www.myget.org/F/dnn-software-public/npm/'
  displayName: 'npm config set registry'
  enabled: false

- powershell: |
   $path = '.\DNN Platform\Library\Properties\AssemblyInfo.cs'
   $pattern3 = '\[assembly: AssemblyStatus'
   (Get-Content $path) | ForEach-Object{
      if($_ -match $pattern3){
       # We have found the matching line
       '[assembly: AssemblyStatus(ReleaseMode.{0})]' -f '$(ReleaseMode)'
      } else {
       $_
      }
     } | Set-Content $path
   
  displayName: 'Update Alpha/Beta/Stable flag'

- task: PowerShell@2
  displayName: 'Run DNN Build via Cake'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=$(CakeTarget) --verbosity=$(CakeVerbosity) --CkBranch="$(Branch.CkEditor)" --CdfBranch="$(Branch.CdfProvider)"'

- task: PowerShell@2
  displayName: 'Run Unit Tests via Cake'
  inputs:
    targetType: filePath
    filePath: ./build.ps1
    arguments: '--target=UnitTests --verbosity=$(CakeVerbosity)'
  continueOnError: true
  condition: and(succeeded(), eq(variables['RunTests'], 'True'))

- task: PublishTestResults@2
  displayName: 'Publish Test Results **/TestResults/*.xml'
  inputs:
    testResultsFormat: VSTest
    testResultsFiles: '**/TestResults/*.xml'
    mergeTestResults: true
{'fraction_non_alphanumeric': 0.1297761700203482, 'fraction_numerical': 0.004973999547818223, 'mean_word_length': 3.617954070981211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '466776', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1434, 'n_words': 358}