botbuilder-dotnet/build/PublishToCoveralls.ps1

72 строки
2.8 KiB
PowerShell
Исходник Постоянная ссылка Обычный вид История

2019-04-18 23:05:15 +03:00
#
2019-04-18 23:17:32 +03:00
# Installs and runs Coveralls.exe to upload coverage files to https://coveralls.io/.
2019-04-18 23:05:15 +03:00
# Arguments example: -coverallsToken $(Coveralls.Token) -pathToCoverageFiles $(Build.SourcesDirectory)\CodeCoverage
#
Param(
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
[string]$coverallsToken = '', # This arg will display in the Azure pipeline log. To hide it, pass it as environment var CoverallsToken instead.
2019-05-10 04:41:50 +03:00
[string]$pathToCoverageFiles,
[string]$serviceName = 'Azure DevOps'
)
Write-Host Install tools
2019-04-12 23:15:40 +03:00
$basePath = (get-item $pathToCoverageFiles ).parent.FullName
$coverageAnalyzer = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"
if (-not (Test-Path $coverageAnalyzer)) {
$coverageAnalyzer = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"
}
dotnet tool install coveralls.net --version 4.0.1 --tool-path tools --add-source https://api.nuget.org/v3/index.json
$coverageUploader = ".\tools\csmacnz.Coveralls.exe"
Write-Host "Analyze coverage [$coverageAnalyzer] with args:"
2019-04-12 23:15:40 +03:00
$coverageFiles = Get-ChildItem -Path "$pathToCoverageFiles" -Include "*.coverage" -Recurse | Select -Exp FullName
$analyzeArgs = @(
"analyze",
2019-04-12 23:15:40 +03:00
"/output:""$pathToCoverageFiles\coverage.coveragexml"""
);
$analyzeArgs += $coverageFiles
Foreach ($i in $analyzeArgs) { Write-Host " $i" }
."$coverageAnalyzer" @analyzeArgs
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
# Get $coverallsToken from environment var
if ($coverallsToken -eq '') {
$coverallsToken = $Env:CoverallsToken;
}
Write-Host "Upload coverage [$coverageUploader] with args"
if (Test-Path env:System_PullRequest_SourceBranch) {
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
$branchName = $env:System_PullRequest_SourceBranch -replace "refs/heads/", ""
}
$uploadArgs = @(
"--dynamiccodecoverage",
2019-04-12 23:15:40 +03:00
"-i ""$pathToCoverageFiles\coverage.coveragexml""",
"-o ""$pathToCoverageFiles\coverage.json"""
"--useRelativePaths",
2019-04-12 23:15:40 +03:00
"--basePath ""$basePath""",
"--repoToken ""$coverallsToken""",
"--jobId ""$env:Build_BuildId""",
"--commitId ""$env:Build_SourceVersion""",
"--commitAuthor ""$env:Build_RequestedFor""",
"--commitEmail ""$env:Build_RequestedForEmail """,
2019-05-10 04:41:50 +03:00
"--commitMessage ""$env:Build_SourceVersionMessage""",
"--serviceName ""$serviceName"""
);
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
if (Test-Path env:System_PullRequest_SourceBranch) {
$uploadArgs += "--commitBranch ""$($env:System_PullRequest_SourceBranch -replace ""refs/heads/"", """")"""
}
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
else {
$uploadArgs += "--commitBranch ""$($env:Build_SourceBranch -replace ""refs/heads/"", """")"""
}
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
if (Test-Path env:System_PullRequest_PullRequestNumber) {
$uploadArgs += "--pullRequest ""$env:System_PullRequest_PullRequestNumber"""
}
Add 2 YAML builds for DotNet CI (#3115) * First try for ci build. * Add var Parameters.solution * Add second job 'Release-Windows' * Fix CoverallsToken * Hide CoverallsToken * Fix job names * Fix path to powershell script. * Add vr BotBuilderDll * Add API validation steps * Fix dependsOn * Add threads generator. * Pool reference added to job: generate_thread_variables * Fix generate_thread_variables * Fix ci-post-to-github-steps.yml * Debug matrix execution * Fix generate_thread_variables * Debug generate_threads.threads * Debug generate_thread_variables 2 * Debug generate_thread_variables 3 * Debug generate_thread_variables 4 * Now trying matrix * matrix fix? * matrix fix 2? * matrix attempt 5 * matrix from scratch example * Just the sample code * delete dependency * Add pool * Add pool to parent * Substituting my matrix string... * Fixed string! * generate_thread_variables fixed * Getting there with MULTIJOBS * Fix timeoutInMinutes * Re-add template calls. * Now with all jobs running. * Replace deprecated CopyPublishBuildArtifacts * Add dir workspace to post-to-github stage * Comments update. * More comment updates. * Comment change 3 * Comment change 5 * Comment change 6 * Add botbuilder-dotnet-ci-mac.yml * Set up var pool: vmImage: 'macOS-latest' * Change vmimage to macOS-10.14 * Change Parameters.solution to Microsoft.Bot.Builder-Standard.sln * Remove Parameters.solution * Cleanup * Comment fix. * Add build tagging, update comments for signed build. * Change build order. * Split out the test steps. * Cleanup
2019-12-11 03:49:36 +03:00
Foreach ($i in $uploadArgs) {
if (-not $i.StartsWith("--repoToken")) {
Write-Host " $i";
} else {
Write-Host " --repoToken ******";
}
}
Start-Process $coverageUploader -ArgumentList $uploadArgs -NoNewWindow