Skip to content

Commit

Permalink
Merge branch 'main' into releases/4.22
Browse files Browse the repository at this point in the history
  • Loading branch information
Tracy Boehrer committed Feb 15, 2024
2 parents d46f6f3 + 07ed900 commit ae68dbb
Show file tree
Hide file tree
Showing 136 changed files with 2,127 additions and 1,033 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/create-botbuilder-parity-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
needs: encode
permissions:
issues: write

strategy:
matrix:
Expand Down
129 changes: 129 additions & 0 deletions build/onebranch/ci-api-validation-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download BotBuilderDLLs from Artifacts'
inputs:
artifactName: 'BotBuilderDLLs-Debug-Windows-netcoreapp31'
targetPath: '$(System.ArtifactsDirectory)/OutputDlls'

- task: DownloadPipelineArtifact@2
displayName: 'Download ContractDlls from Artifacts'
inputs:
artifactName: 'ContractDlls'
targetPath: '$(System.ArtifactsDirectory)/ContractDlls'

- powershell: |
Write-Host "The following API compatibility issues are suppressed:";
Get-Content "ApiCompatBaseline.txt";
displayName: 'Show API compat issue suppressions in ApiCompatBaseline.txt'
continueOnError: true

- task: SOUTHWORKS.binaries-comparer.custom-build-release-task.binaries-comparer@0
displayName: 'Compare Binaries'
inputs:
contractsRootFolder: '$(System.ArtifactsDirectory)/ContractDlls'
contractsFileName: '$(PackageName).dll'
implFolder: '$(System.ArtifactsDirectory)/OutputDlls'
failOnIssue: false
resolveFx: false
generateLog: true
outputFilename: '$(PackageName).$(ApiContractVersion).CompatResults.txt'
outputFolder: '$(Build.ArtifactStagingDirectory)'
useBaseline: true
baselineFile: ApiCompatBaseline.txt
continueOnError: false

- powershell: |
$filePath = "$(Build.ArtifactStagingDirectory)\$(PackageName).$(ApiContractVersion).CompatResults.txt"
$nugetLink = "compared against [version $(ApiContractVersion)](https://www.nuget.org/packages/$(PackageName)/$(ApiContractVersion)).";
Write-Host "Compatibility Check:";
if (-not (Test-Path $filePath)) {
$content = "The binary compatibility report for library '$(PackageName)' wasn't generated. This may have happened because the NuGet library '$(PackageName)' for version '$(ApiContractVersion)' was unavailable or a connectivity issue."
New-Item -Path '$(Build.ArtifactStagingDirectory)' -Name '$(PackageName).$(ApiContractVersion).CompatResults.txt' -ItemType "file" -Value $content
$content;
Write-Host "##vso[task.complete result=Failed;]";
return;
}
$baseline = Get-Content $filePath -Raw;
Write-Host "`n[Compare binaries task]";
Write-Host "`nOriginal result:";
$baseline;
# When the Api Compat task has Binary compatibility issues, this process will filter out the Classes
# and then validates if still exists remaining issues.
if ($baseline.ToString().Trim().StartsWith(':x:')) {
Write-Host "`n[Class exclusion]";
$excludeClasses = "$($env:ApiCompatExcludeClasses)".Trim().Split(',') | Where-Object { ($_.Trim().Length -gt 0) } | ForEach-Object { $_.Trim() };
if ($excludeClasses) {
Write-Host "`nList of classes to exclude:";
$excludeClasses | ForEach-Object { " - " + $_ }
}
else {
Write-Host "`nThere are no classes to exclude.";
}
$content = ($baseline -split '<details\>|<\/details\>');
$header = $content[0].SubString($content[0].IndexOf('Binary') - 1).Trim();
$issues = $content[1].Trim();
$issues = ($issues -replace '```', '').Split([Environment]::NewLine);
# Filter out issues based on Class name.
$issues = @(
$issues | Where-Object {
$line = $_;
if (-not $line.Trim()) {
return $false;
}
if ($excludeClasses) {
foreach ($class in $excludeClasses) {
$pattern = "'$class";
if ($line -match $pattern) {
return $false;
}
}
}
return $true;
} | ForEach-Object { $_.Trim() }
)
# Creates new file content.
if ($issues) {
$newFile = @();
$newfile += ":x: $($issues.Length) $header $nugetLink";
$newFile += '<details>';
$newFile += "";
$newFile += '```';
$newfile += $issues;
$newFile += '```';
$newFile += "";
$newFile += '</details>';
$newFile = $newFile -join [Environment]::NewLine;
Write-Host "##vso[task.complete result=Failed;]";
}
else {
$newFile = ":heavy_check_mark: No Binary Compatibility issues for **$(PackageName)** $nugetLink";
}
$baseline = $newFile;
[system.io.file]::WriteAllText($filePath, $baseline);
Write-Host "`nProcessed result:";
$baseline;
}
displayName: 'Compatibility Check'
continueOnError: false
condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
displayName: 'Publish Compat Results artifact'
inputs:
ArtifactName: '$(PackageName).$(ApiContractVersion).CompatResults'
condition: succeededOrFailed()

- script: |
dir .. /s
displayName: 'Dir workspace'
continueOnError: true
condition: succeededOrFailed()
44 changes: 44 additions & 0 deletions build/onebranch/ci-build-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
steps:
- powershell: 'gci env:* | sort-object name | Format-Table -AutoSize -Wrap'
displayName: 'Display env vars'

# Variables ReleasePackageVersion and PreviewPackageVersion are consumed by projects in Microsoft.Bot.Builder.sln.
# For the signed build, they should be settable at queue time. To set that up, define the variables in Azure on the Variables tab.
- task: NuGetToolInstaller@1
displayName: 'Use NuGet '

- template: sdk_dotnet_v4_org-feed-setup-steps.yml

- task: NuGetToolInstaller@1
displayName: 'Use NuGet latest'

- task: NuGetCommand@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'nuget.config'
restoreSolution: '$(Parameters.solution)'
displayName: 'NuGet restore'

- task: VSBuild@1
displayName: 'Build solution Microsoft.Bot.Builder.sln'
inputs:
solution: '$(Parameters.solution)'
vsVersion: 17.0
msbuildArgs: '$(MSBuildArguments)'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
maximumCpuCount: true
logProjectEvents: false

#- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
# displayName: 'Component Detection'
# inputs:
# failOnAlert: true

#- script: |
# cd ..
# dir *.* /s
# displayName: 'Dir workspace'
# continueOnError: true
# condition: succeededOrFailed()
8 changes: 8 additions & 0 deletions build/onebranch/ci-component-detection-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
steps:
- task: ComponentGovernanceComponentDetection@0
displayName: Component Detection
inputs:
scanType: "Register"
verbosity: "Verbose"
alertWarningLevel: "High"
failOnAlert: true
38 changes: 38 additions & 0 deletions build/onebranch/ci-post-to-github-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download compat results artifact'
inputs:
downloadType: specific
itemPattern: '**\*.txt'
downloadPath: '$(System.ArtifactsDirectory)\ApiCompat'

- task: CopyFiles@2
displayName: 'Copy results for publish to Artifacts'
inputs:
SourceFolder: '$(System.ArtifactsDirectory)\ApiCompat'
Contents: '**\*.txt'
TargetFolder: '$(System.ArtifactsDirectory)\ApiCompatibilityResults'
flattenFolders: true

- task: PublishPipelineArtifact@1
inputs:
artifactName: 'ApiCompatibilityResults'
targetPath: '$(System.ArtifactsDirectory)\ApiCompatibilityResults'
displayName: 'Publish compat results to Artifacts'
continueOnError: true

- task: SOUTHWORKS.github-pr-comment.custom-publish-comment-task.github-pr-comment@0
displayName: 'Publish compat results to GitHub'
inputs:
userToken: '$(GitHubCommentApiKey)'
bodyFilePath: '$(System.ArtifactsDirectory)\ApiCompat'
getSubFolders: true
keepCommentHistory: false
# Skip for forks, as secret tokens are not available to them.
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), ne(variables['System.PullRequest.IsFork'], 'True'))

- script: |
dir .. /s
displayName: 'Dir workspace'
continueOnError: true
condition: succeededOrFailed()
106 changes: 106 additions & 0 deletions build/onebranch/ci-test-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#variables:
# DotNetCoverallsToken: define this in Azure
# PublishCoverage: (optional) set to true in the calling template.
steps:
- powershell: |
Remove-Item CodeCoverage -Force -Recurse -ErrorAction Ignore
New-Item CodeCoverage -ItemType Directory -Force
displayName: 'Create Code Coverage directory'

- task: NodeTool@0
displayName: 'install Node.js v14.x'
inputs:
versionSpec: '14.x'

- task: Npm@1
displayName: 'install botframework-cli to set up for Schema merge tests'
inputs:
command: custom
verbose: false
customCommand: 'install -g @microsoft/botframework-cli@next'

- task: UseDotNet@2
displayName: "Install .NET Core 3.1.415"
continueOnError: true
inputs:
packageType: "sdk"
version: 3.1.415
condition: and(succeeded(), eq(variables['BuildConfiguration'],'Release-Windows'), eq(variables['BuildTarget'],'netcoreapp31'))

- task: DotNetCoreCLI@2
displayName: 'dotnet test (release) 3.1'
inputs:
command: test
projects: |
Tests/**/*Tests.csproj
arguments: '-v n -f netcoreapp3.1 --configuration release --no-build --no-restore --filter "TestCategory!=IgnoreInAutomatedBuild&TestCategory!=FunctionalTests" --collect:"Code Coverage" --settings $(Build.SourcesDirectory)\CodeCoverage.runsettings'
condition: and(succeeded(), eq(variables['BuildConfiguration'],'Release-Windows'), eq(variables['BuildTarget'],'netcoreapp31'))

- task: DotNetCoreCLI@2
displayName: 'dotnet test (release) 6.0'
inputs:
command: test
projects: |
Tests/**/*Tests.csproj
arguments: '-v n -f net6.0 --configuration release --no-build --no-restore --filter "TestCategory!=IgnoreInAutomatedBuild&TestCategory!=FunctionalTests" --collect:"Code Coverage" --settings $(Build.SourcesDirectory)\CodeCoverage.runsettings'
condition: and(succeeded(), eq(variables['BuildConfiguration'],'Release-Windows'), eq(variables['BuildTarget'],'net6'))

- powershell: |
# This task copies the code coverage file created by dotnet test into a well known location. In all
# checks I've done, dotnet test ALWAYS outputs the coverage file to the temp directory.
# My attempts to override this and have it go directly to the CodeCoverage directory have
# all failed, so I'm just doing the copy here. (cmullins)
Get-ChildItem -Path "D:\a\_temp" -Include "*.coverage" -Recurse | Copy-Item -Destination CodeCoverage
displayName: 'Copy .coverage Files to CodeCoverage folder'
condition: and(succeeded(), eq(variables['PublishCoverage'], 'true'))

- powershell: 'echo ''##vso[task.setvariable variable=CoverallsToken]$(DotNetCoverallsToken)'''
displayName: 'Set CoverallsToken for PublishToCoveralls.ps1 if token exists'
continueOnError: true
condition: and(succeeded(), eq(variables['PublishCoverage'], 'true'))

- powershell: |
dotnet nuget remove source SDK_Dotnet_V4_org
displayName: Remove SDK_Dotnet_V4_org feed source reference from nuget.config
continueOnError: true
condition: and(succeeded(), eq(variables['PublishCoverage'], 'true'), ne(variables['System.PullRequest.IsFork'], 'True'))

- task: PowerShell@2
displayName: 'Upload Coverage Files to Coveralls.io https://coveralls.io/github/microsoft/botbuilder-dotnet'
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)\build\PublishToCoveralls.ps1'
arguments: '-pathToCoverageFiles "$(Build.SourcesDirectory)\CodeCoverage" -serviceName "CI-PR build"'
continueOnError: true
# Skip for forks because it errors: "Couldn't find a repository matching this job."
condition: and(succeeded(), eq(variables['PublishCoverage'], 'true'), ne(variables['System.PullRequest.IsFork'], 'True'))

- powershell: |
New-Item -ItemType directory -Path "outputLibraries\" -Force
$buildTarget = $env:BuildConfiguration.Split("-")[0];
$env:PackagesToValidate.Split(",") | ForEach {
$library = $_.Trim()
Write-Host $library
Get-ChildItem -Path "*/$library/bin/$buildTarget/netstandard2.0/$library.dll" -Recurse | Copy-Item -Destination 'outputLibraries\' -Force
Get-ChildItem -Path "*/*/$library/bin/$buildTarget/netstandard2.0/$library.dll" -Recurse | Copy-Item -Destination 'outputLibraries\' -Force
}
displayName: 'Copy DLLs to outputLibraries folder'

- task: PublishPipelineArtifact@0
displayName: 'Publish Microsoft.Bot.Builder DLLs artifact'
inputs:
artifactName: 'BotBuilderDLLs-$(BuildConfiguration)-$(BuildTarget)'
targetPath: outputLibraries
continueOnError: true

- script: |
dir .. /s
displayName: 'Dir workspace'
continueOnError: true
condition: succeededOrFailed()
43 changes: 43 additions & 0 deletions build/onebranch/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#variables:
# BuildConfiguration: Release-Windows
# TestConfiguration: Release
# BuildPlatform: any cpu
# MSBuildArguments: -p:PublishRepositoryUrl=true -p:GeneratePackages=true -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
# Packaging.EnableSBOMSigning: true
# Parameters.solution: Microsoft.Bot.Builder.sln
## PreviewPackageVersion: 4.8.0-preview-$(Build.BuildNumber) # Consumed by projects in Microsoft.Bot.Builder.sln. Define this in Azure to be settable at queue time.
## ReleasePackageVersion: 4.8.0-preview-$(Build.BuildNumber) # Consumed by projects in Microsoft.Bot.Builder.sln. Define this in Azure to be settable at queue time.
## SDK_Dotnet_V4_org_Url: define this in Azure

steps:
- powershell: |
# Replace {DateStamp} and {CommitHash} tokens with the actual values in vars ReleasePackageVersion and PreviewPackageVersion
$dateStamp = (Get-Date -format "yyyyMMdd");
$commitHash = "$(Build.SourceVersion)".SubString(0,7);
"Raw ReleasePackageVersion = $(ReleasePackageVersion)";
$v = "$(ReleasePackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=ReleasePackageVersion;]$v";
"Resolved ReleasePackageVersion = $v";
"Raw PreviewPackageVersion = $(PreviewPackageVersion)";
$ppv = "$(PreviewPackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=PreviewPackageVersion;]$ppv";
"Resolved PreviewPackageVersion = $ppv";
displayName: 'Resolve package version variables'
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag build with release and preview versions'
inputs:
tags: |
Release: $(ReleasePackageVersion)
Preview: $(PreviewPackageVersion)
continueOnError: true

- template: ci-build-steps.yml
- template: sign-steps.yml

# - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
# displayName: 'Component Detection'
# inputs:
# failOnAlert: false
Loading

0 comments on commit ae68dbb

Please sign in to comment.