<commit_before>trigger:
  branches:
    include:
    - main

schedules:
- cron: "0 0 * * *"
  displayName: Daily midnight build
  branches:
    include:
    - main

parameters:
  - name: build_configuration
    displayName: Build configuration
    type: string
    default: Release
    values:
    - Release
    - Debug
  - name: version_suffix
    displayName: Version suffix
    type: string
    default: ci.$(Build.BuildNumber)
  - name: codesign
    displayName: Enable code signing
    type: boolean
    default: false
  - name: skip_test
    displayName: Skip tests
    type: boolean
    default: false
  - name: frameworks
    displayName: Frameworks
    type: object
    default:
    - net7.0
  - name: tests_categories
    displayName: Test categories
    type: object
    default:
    - BVT
    - SlowBVT
    - Functional

variables:
  CodeQL.Enabled: true
  build_flags: ' /m /v:m' 
  solution: 'Orleans.sln'
  codesign_runtime: '2.1.x'
  ${{ if eq(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
    pool_name: 'orleans-pr-hosted-pool'
    official_build: false
  ${{ else }}:
    pool_name: 'orleans-build-hosted-pool'
    official_build: true

jobs:

# Build, sign dlls, build nuget pkgs, then sign them
- job: Build
  pool: $(pool_name)
  displayName: Build and create NuGet packages
  steps:
  - checkout: self
  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk'
    inputs:
      useGlobalJson: true
  - task: DotNetCoreCLI@2
    displayName: Build
    inputs:
      command: build
      arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
    env:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)
  # DLL code signing 
  - ${{ if eq(parameters.codesign, true) }}:
    - task: UseDotNet@2
      displayName: 'Codesign: Use .NET Core'
      inputs:
        packageType: runtime
        version: $(codesign_runtime)
    - task: CopyFiles@2
      displayName: 'Codesign: Copy Files for signing'
      inputs:
        SourceFolder: '$(build.sourcesdirectory)'
        Contents: |
          src/**/bin/${{parameters.build_configuration}}/**/Orleans*.dll
          src/**/bin/${{parameters.build_configuration}}/**/Microsoft.Orleans.*.dll
          !src/BootstrapBuild/**
        TargetFolder: '$(build.artifactstagingdirectory)\codesign'
        CleanTargetFolder: true
    - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
      displayName: 'Codesign: ESRP CodeSigning'
      inputs:
        ConnectedServiceName: 'CodeSign Service (NuGet)'
        FolderPath: '$(build.artifactstagingdirectory)\codesign'
        Pattern: '*'
        signConfigType: inlineSignParams
        inlineOperation: |
          [
            {
              "keyCode": "CP-230012",
              "operationSetCode": "SigntoolSign",
              "parameters": [
                {
                  "parameterName": "OpusName",
                  "parameterValue": "Microsoft"
                },
                {
                  "parameterName": "OpusInfo",
                  "parameterValue": "http://www.microsoft.com"
                },
                {
                  "parameterName": "FileDigest",
                  "parameterValue": "/fd \"SHA256\""
                },
                {
                  "parameterName": "PageHash",
                  "parameterValue": "/NPH"
                },
                {
                  "parameterName": "TimeStamp",
                  "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
                }
              ],
                "toolName": "sign",
                "toolVersion": "1.0"
              },
              {
                "keyCode": "CP-230012",
                "operationSetCode": "SigntoolVerify",
                "parameters": [ ],
                "toolName": "sign",
                "toolVersion": "1.0"
            }
          ]
        SessionTimeout: 180
        VerboseLogin: true
    - task: CopyFiles@2
      displayName: 'Codesign: Copy Signed Files Back'
      inputs:
        SourceFolder: '$(build.artifactstagingdirectory)\codesign'
        Contents: '**\*'
        TargetFolder: '$(build.sourcesdirectory)'
        OverWrite: true
    # End DLL code signing
  - task: CmdLine@2
    displayName: Pack
    inputs:
      script: 'dotnet pack --no-build --no-restore $(build_flags) /bl:${{parameters.build_configuration}}-Pack.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
    env:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)
  # NuGet code signing
  - ${{ if eq(parameters.codesign, true) }}:
    - task: UseDotNet@2
      displayName: 'Codesign: Use .NET Core'
      inputs:
        packageType: runtime
        version: $(codesign_runtime)
    - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
      displayName: 'Codesign: ESRP CodeSigning (nuget)'
      inputs:
        ConnectedServiceName: 'CodeSign Service (NuGet)'
        FolderPath: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
        Pattern: '*.nupkg'
        signConfigType: inlineSignParams
        inlineOperation: |
          [
            {
              "keyCode": "CP-401405",
              "operationSetCode": "NuGetSign",
              "parameters": [],
              "toolName": "sign",
              "toolVersion": "1.0"
            },
            {
              "keyCode": "CP-401405",
              "operationSetCode": "NuGetVerify",
              "parameters": [ ],
              "toolName": "sign",
              "toolVersion": "1.0"
            }
          ]
        SessionTimeout: 180
        VerboseLogin: true
  # End NuGet code signing
  - ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: Nuget Packages'
      inputs:
        PathtoPublish: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
        ArtifactName: nuget

# Tests
- ${{ if eq(parameters.skip_test, false) }}:
  - ${{ each category in parameters.tests_categories }}:
    - ${{ each framework in parameters.frameworks }}:
      - job:
        displayName: ${{category}} on ${{framework}}
        timeoutInMinutes: 120
        pool: $(pool_name)
        dependsOn: Build
        steps:
        - checkout: self
        - task: UseDotNet@2
          inputs:
            useGlobalJson: true
          displayName: 'Use .NET Core sdk'
        - task: DotNetCoreCLI@2
          displayName: Build
          inputs:
            command: build
            arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
        - ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
          - task: DownloadSecureFile@1
            name: secretFile
            displayName: 'Download secrets'
            inputs:
              secureFile: 'OrleansTestSecrets.json'
        - task: DotNetCoreCLI@2
          displayName: Test
          inputs:
            command: 'test'
            testRunTitle: ${{category}} on ${{framework}}
            arguments: '--no-build --framework ${{framework}} --configuration "${{parameters.build_configuration}}" --filter Category=${{category}} -- -parallel none -noshadow'
          ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
            env:
              ORLEANS_SECRETFILE: $(secretFile.secureFilePath)

  
<commit_msg>Fix casing on CodeQL enablement variable (#8036)<commit_after>trigger:
  branches:
    include:
    - main

schedules:
- cron: "0 0 * * *"
  displayName: Daily midnight build
  branches:
    include:
    - main

parameters:
  - name: build_configuration
    displayName: Build configuration
    type: string
    default: Release
    values:
    - Release
    - Debug
  - name: version_suffix
    displayName: Version suffix
    type: string
    default: ci.$(Build.BuildNumber)
  - name: codesign
    displayName: Enable code signing
    type: boolean
    default: false
  - name: skip_test
    displayName: Skip tests
    type: boolean
    default: false
  - name: frameworks
    displayName: Frameworks
    type: object
    default:
    - net7.0
  - name: tests_categories
    displayName: Test categories
    type: object
    default:
    - BVT
    - SlowBVT
    - Functional

variables:
  Codeql.Enabled: true
  build_flags: ' /m /v:m' 
  solution: 'Orleans.sln'
  codesign_runtime: '2.1.x'
  ${{ if eq(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
    pool_name: 'orleans-pr-hosted-pool'
    official_build: false
  ${{ else }}:
    pool_name: 'orleans-build-hosted-pool'
    official_build: true

jobs:

# Build, sign dlls, build nuget pkgs, then sign them
- job: Build
  pool: $(pool_name)
  displayName: Build and create NuGet packages
  steps:
  - checkout: self
  - task: UseDotNet@2
    displayName: 'Use .NET Core sdk'
    inputs:
      useGlobalJson: true
  - task: DotNetCoreCLI@2
    displayName: Build
    inputs:
      command: build
      arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
    env:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)
  # DLL code signing 
  - ${{ if eq(parameters.codesign, true) }}:
    - task: UseDotNet@2
      displayName: 'Codesign: Use .NET Core'
      inputs:
        packageType: runtime
        version: $(codesign_runtime)
    - task: CopyFiles@2
      displayName: 'Codesign: Copy Files for signing'
      inputs:
        SourceFolder: '$(build.sourcesdirectory)'
        Contents: |
          src/**/bin/${{parameters.build_configuration}}/**/Orleans*.dll
          src/**/bin/${{parameters.build_configuration}}/**/Microsoft.Orleans.*.dll
          !src/BootstrapBuild/**
        TargetFolder: '$(build.artifactstagingdirectory)\codesign'
        CleanTargetFolder: true
    - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
      displayName: 'Codesign: ESRP CodeSigning'
      inputs:
        ConnectedServiceName: 'CodeSign Service (NuGet)'
        FolderPath: '$(build.artifactstagingdirectory)\codesign'
        Pattern: '*'
        signConfigType: inlineSignParams
        inlineOperation: |
          [
            {
              "keyCode": "CP-230012",
              "operationSetCode": "SigntoolSign",
              "parameters": [
                {
                  "parameterName": "OpusName",
                  "parameterValue": "Microsoft"
                },
                {
                  "parameterName": "OpusInfo",
                  "parameterValue": "http://www.microsoft.com"
                },
                {
                  "parameterName": "FileDigest",
                  "parameterValue": "/fd \"SHA256\""
                },
                {
                  "parameterName": "PageHash",
                  "parameterValue": "/NPH"
                },
                {
                  "parameterName": "TimeStamp",
                  "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
                }
              ],
                "toolName": "sign",
                "toolVersion": "1.0"
              },
              {
                "keyCode": "CP-230012",
                "operationSetCode": "SigntoolVerify",
                "parameters": [ ],
                "toolName": "sign",
                "toolVersion": "1.0"
            }
          ]
        SessionTimeout: 180
        VerboseLogin: true
    - task: CopyFiles@2
      displayName: 'Codesign: Copy Signed Files Back'
      inputs:
        SourceFolder: '$(build.artifactstagingdirectory)\codesign'
        Contents: '**\*'
        TargetFolder: '$(build.sourcesdirectory)'
        OverWrite: true
    # End DLL code signing
  - task: CmdLine@2
    displayName: Pack
    inputs:
      script: 'dotnet pack --no-build --no-restore $(build_flags) /bl:${{parameters.build_configuration}}-Pack.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
    env:
      VersionSuffix: ${{parameters.version_suffix}}
      OfficialBuild: $(official_build)
  # NuGet code signing
  - ${{ if eq(parameters.codesign, true) }}:
    - task: UseDotNet@2
      displayName: 'Codesign: Use .NET Core'
      inputs:
        packageType: runtime
        version: $(codesign_runtime)
    - task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
      displayName: 'Codesign: ESRP CodeSigning (nuget)'
      inputs:
        ConnectedServiceName: 'CodeSign Service (NuGet)'
        FolderPath: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
        Pattern: '*.nupkg'
        signConfigType: inlineSignParams
        inlineOperation: |
          [
            {
              "keyCode": "CP-401405",
              "operationSetCode": "NuGetSign",
              "parameters": [],
              "toolName": "sign",
              "toolVersion": "1.0"
            },
            {
              "keyCode": "CP-401405",
              "operationSetCode": "NuGetVerify",
              "parameters": [ ],
              "toolName": "sign",
              "toolVersion": "1.0"
            }
          ]
        SessionTimeout: 180
        VerboseLogin: true
  # End NuGet code signing
  - ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: Nuget Packages'
      inputs:
        PathtoPublish: '$(build.sourcesdirectory)/Artifacts/${{parameters.build_configuration}}'
        ArtifactName: nuget

# Tests
- ${{ if eq(parameters.skip_test, false) }}:
  - ${{ each category in parameters.tests_categories }}:
    - ${{ each framework in parameters.frameworks }}:
      - job:
        displayName: ${{category}} on ${{framework}}
        timeoutInMinutes: 120
        pool: $(pool_name)
        dependsOn: Build
        steps:
        - checkout: self
        - task: UseDotNet@2
          inputs:
            useGlobalJson: true
          displayName: 'Use .NET Core sdk'
        - task: DotNetCoreCLI@2
          displayName: Build
          inputs:
            command: build
            arguments: '$(build_flags) /bl:${{parameters.build_configuration}}-Build.binlog /p:Configuration=${{parameters.build_configuration}} $(solution)'
        - ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
          - task: DownloadSecureFile@1
            name: secretFile
            displayName: 'Download secrets'
            inputs:
              secureFile: 'OrleansTestSecrets.json'
        - task: DotNetCoreCLI@2
          displayName: Test
          inputs:
            command: 'test'
            testRunTitle: ${{category}} on ${{framework}}
            arguments: '--no-build --framework ${{framework}} --configuration "${{parameters.build_configuration}}" --filter Category=${{category}} -- -parallel none -noshadow'
          ${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
            env:
              ORLEANS_SECRETFILE: $(secretFile.secureFilePath)

  

{'fraction_non_alphanumeric': 0.12415997912181119, 'fraction_numerical': 0.009786651008025053, 'mean_word_length': 2.037051713889439, 'pattern_counts': {'":': 60, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3920610', 'n_tokens_mistral': 4544, 'n_tokens_neox': 4298, 'n_words': 928}