diff --git a/build/botframework-wechat-dotnet-daily.yml b/build/botframework-wechat-dotnet-daily.yml new file mode 100644 index 0000000..3444d92 --- /dev/null +++ b/build/botframework-wechat-dotnet-daily.yml @@ -0,0 +1,36 @@ +ame: $(Build.BuildId) +variables: + BuildConfiguration: Release + BuildPlatform: Any CPU + CoverallsToken: define this in Azure + Parameters.solution: libraries/csharp_dotnetcore/csharp_dotnetcore.sln +pool: + name: Hosted Windows 2019 with VS2019 + demands: + - msbuild + - visualstudio + +trigger: + branches: + include: + - master + paths: + include: + - '*' + exclude: + - doc/* + - libraries/typescript/* + - samples/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - LICENSE + - README.md + - SECURITY.md + +pr: none + +jobs: +- job: Build_and_Sign + steps: + - template: dotnet-build-steps.yml + - template: dotnet-sign-steps.yml \ No newline at end of file diff --git a/build/botframework-wechat-dotnet.yml b/build/botframework-wechat-dotnet.yml index 16386ac..1ec41ee 100644 --- a/build/botframework-wechat-dotnet.yml +++ b/build/botframework-wechat-dotnet.yml @@ -3,9 +3,6 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml -trigger: -- master - name: $(Build.BuildId) variables: BuildConfiguration: Debug @@ -18,6 +15,40 @@ pool: - msbuild - visualstudio +trigger: + branches: + include: + - master + paths: + include: + - '*' + exclude: + - doc/* + - libraries/typescript/* + - samples/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - LICENSE + - README.md + - SECURITY.md + +pr: + branches: + include: + - master + paths: + include: + - '*' + exclude: + - doc/* + - libraries/typescript/* + - samples/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - LICENSE + - README.md + - SECURITY.md + steps: - powershell: 'gci env:* | sort-object name | Format-Table -AutoSize -Wrap' displayName: 'Display env vars' diff --git a/build/botframework-wechat-js.yml b/build/botframework-wechat-js.yml index 71be8be..36d36fa 100644 --- a/build/botframework-wechat-js.yml +++ b/build/botframework-wechat-js.yml @@ -19,6 +19,11 @@ pr: - doc/* - libraries/csharp_dotnetcore/* - samples/* + - CODE_OF_CONDUCT.md + - CONTRIBUTING.md + - LICENSE + - README.md + - SECURITY.md jobs: - job: WeChat diff --git a/build/dotnet-build-steps.yml b/build/dotnet-build-steps.yml new file mode 100644 index 0000000..2298c6e --- /dev/null +++ b/build/dotnet-build-steps.yml @@ -0,0 +1,48 @@ +steps: +- powershell: 'gci env:* | sort-object name | Format-Table -AutoSize -Wrap' + displayName: 'Display env vars' + +- task: NuGetToolInstaller@0 + displayName: 'Use NuGet 4.9.1' + inputs: + versionSpec: 4.9.1 + +- task: NuGetCommand@2 + displayName: 'NuGet restore' + inputs: + restoreSolution: '$(Parameters.solution)' + +- task: VSBuild@1 + displayName: 'Build solution libraries/csharp_dotnetcore/csharp_dotnetcore.sln' + inputs: + solution: '$(Parameters.solution)' + vsVersion: "latest" + msbuildArgs: '-p:SignAssembly=false -p:delaySign=false' + platform: '$(BuildPlatform)' + configuration: '$(BuildConfiguration)' + +- task: DotNetCoreCLI@2 + displayName: 'dotnet test (release)' + inputs: + command: test + projects: | + libraries/csharp_dotnetcore/Tests/**/*Tests.csproj + + arguments: '-v n --configuration release --no-build --no-restore --filter TestCategory!=IgnoreInAutomatedBuild --collect:"Code Coverage"' + condition: eq(variables['BuildConfiguration'],'Release') + +- script: | + cd .. + dir *.* /s + displayName: 'Dir workspace' + +- task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: build folder' + inputs: + PathtoPublish: build + ArtifactName: build + +- script: | + cd .. + dir *.* /s + displayName: 'Dir workspace' \ No newline at end of file diff --git a/build/dotnet-sign-steps.yml b/build/dotnet-sign-steps.yml new file mode 100644 index 0000000..d22ae4c --- /dev/null +++ b/build/dotnet-sign-steps.yml @@ -0,0 +1,217 @@ +steps: +- task: CopyFiles@2 + displayName: 'Copy packages to Signing' + inputs: + SourceFolder: '$(build.sourcesdirectory)' + Contents: | + outputpackages\*.nupkg + outputpackages\*.snupkg + !outputpackages\*.symbols.nupkg + TargetFolder: '$(build.artifactstagingdirectory)\Signing' + flattenFolders: true + +- task: PowerShell@2 + displayName: 'Unpack .nuget packages' + inputs: + targetType: filePath + filePath: ./build/ExtractCompressNuGet.ps1 + arguments: '$(Build.ArtifactStagingDirectory)\Signing -Extract' + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP Signing - strong name (CP-233863-SN)' + inputs: + ConnectedServiceName: 'ESRP Code Signing Connection 2020' + FolderPath: '$(build.artifactstagingdirectory)\Signing' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameSign", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-233863-SN", + "operationSetCode": "StrongNameVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + + SessionTimeout: 20 + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP Signing - authenticode (CP-230012)' + inputs: + ConnectedServiceName: 'ESRP Code Signing Connection 2020' + FolderPath: '$(build.artifactstagingdirectory)\Signing' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/t \"http://ts4096.gtm.microsoft.com/TSS/AuthenticodeTS\"" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: 20 + +- script: | + cd .. + dir *.* /s + displayName: 'Dir workspace' + +- task: PowerShell@2 + displayName: 'Repack .nuget packages' + inputs: + targetType: filePath + filePath: ./build/ExtractCompressNuGet.ps1 + arguments: '$(Build.ArtifactStagingDirectory)\Signing -Compress' + +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 + displayName: 'ESRP Signing - *.nupkg,*.snupkg (CP-401405)' + inputs: + ConnectedServiceName: 'ESRP Code Signing Connection 2020' + FolderPath: '$(build.artifactstagingdirectory)\Signing' + Pattern: '*.nupkg,*.snupkg' + 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: 20 + +- task: CopyFiles@2 + displayName: 'Copy *.nupkg,*.snupkg files to publish' + inputs: + SourceFolder: '$(Build.ArtifactStagingDirectory)\Signing' + Contents: | + *.nupkg + *.snupkg + !*.symbols.nupkg + TargetFolder: '$(Build.ArtifactStagingDirectory)\publish' + +- task: PublishBuildArtifacts@1 + displayName: 'Push *.nupkg,*.snupkg files to Artifacts Packages' + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)\publish' + ArtifactName: Packages + +- powershell: | + [string[]]$outvar = (Get-ChildItem *.nupkg -Path $(Build.ArtifactStagingDirectory)\publish ).BaseName; + + [int] $packageCount = $outvar.Length; + $PackagesDescription = "$packageCount packages"; + Write-Host $PackagesDescription + "##vso[task.setvariable variable=PackagesDescription;]$PackagesDescription"; + + ## Log the package names + for ($i = 0; $i -lt $packageCount; $i++ ) { + Write-Host $outvar[$i]; + } + + if ($packageCount -gt 30) { + ## Too many packages for tags. Show this message instead + $message = "See the 'Get package names' log output for their names"; + Write-Host "##vso[task.setvariable variable=pkg0;]$message"; + $packageCount = 1; + } else { + ## Set package name variables for tags + for ($i = 0; $i -lt $packageCount; $i++ ) { + $p = $outvar[$i]; + "##vso[task.setvariable variable=pkg$i;]$p"; + } + } + + for ($i = $packageCount; $i -le 30; $i++ ) { + ## Set remaining variables to an empty string + "##vso[task.setvariable variable=pkg$i;]"; + } + displayName: 'Get package names' + continueOnError: true + +- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0 + displayName: 'Tag Build with package names' + inputs: + tags: | + $(PACKAGESDESCRIPTION) + $(PKG0) + $(PKG1) + $(PKG2) + $(PKG3) + $(PKG4) + $(PKG5) + $(PKG6) + $(PKG7) + $(PKG8) + $(PKG9) + $(PKG10) + $(PKG11) + $(PKG12) + $(PKG13) + $(PKG14) + $(PKG15) + $(PKG16) + $(PKG17) + $(PKG18) + $(PKG19) + $(PKG20) + $(PKG21) + $(PKG22) + $(PKG23) + $(PKG24) + $(PKG25) + $(PKG26) + $(PKG27) + $(PKG28) + $(PKG29) + continueOnError: true + +- script: | + cd .. + dir *.* /s + displayName: 'Dir workspace' + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file