diff --git a/tools/devops/automation/scripts/GitHub.psm1 b/tools/devops/automation/scripts/GitHub.psm1 index 773b888d0afe..8fa32cbe43ee 100644 --- a/tools/devops/automation/scripts/GitHub.psm1 +++ b/tools/devops/automation/scripts/GitHub.psm1 @@ -525,11 +525,18 @@ function New-GitHubSummaryComment { Set-GitHubStatus -Status "failure" -Description "Tests failed catastrophically on $Context (no summary found)." -Context "$Context" $request = New-GitHubComment -Header "Tests failed catastrophically on $Context (no summary found)." -Emoji ":fire:" -Description "Result file $TestSummaryPath not found. $headerLinks" } else { + + # set the context to be "pipeline name (Test run)", example xamarin-macios (Test run) + $statusContext = "$Env:BUILD_DEFINITIONNAME (Test run)" + if ($Context -ne "Build") { #special case when we deal with the device tests + $statusContext = "$Contex - $Env:BUILD_DEFINITIONNAME) (Test run)" + } + if (Test-JobSuccess -Status $Env:TESTS_JOBSTATUS) { - Set-GitHubStatus -Status "success" -Description "Tests passed on $Context." -Context "$Context" + Set-GitHubStatus -Status "success" -Description "All tests passed on $Context." -Context $statusContext $request = New-GitHubCommentFromFile -Header "Tests passed on $Context." -Description "Tests passed on $Context. $headerLinks" -Emoji ":white_check_mark:" -Path $TestSummaryPath } else { - Set-GitHubStatus -Status "failure" -Description "Tests failed on $Context." -Context "$Context" + Set-GitHubStatus -Status "error" -Description "Tests failed on $Context." -Context $statusContext $request = New-GitHubCommentFromFile -Header "Tests failed on $Context" -Description "Tests failed on $Context. $headerLinks" -Emoji ":x:" -Path $TestSummaryPath } } diff --git a/tools/devops/automation/templates/build/publish-html.yml b/tools/devops/automation/templates/build/publish-html.yml index 745114fa9c82..24ae18e161c6 100644 --- a/tools/devops/automation/templates/build/publish-html.yml +++ b/tools/devops/automation/templates/build/publish-html.yml @@ -106,13 +106,6 @@ steps: $response = New-GitHubSummaryComment -Context "$Env:CONTEXT" -TestSummaryPath "$Env:TESTS_SUMMARY" -APIDiff "$Env:APIDIFF_JSON_PATH" Write-Host $response } - if($Env:TESTS_JOBSTATUS -ne "Succeeded") - { - Set-PipelineResult -Status partiallySucceeded - Set-GitHubStatus -Status "error" -Description "Some tests failed." -Context "$(Build.DefinitionName) (Test run)" - } else { - Set-GitHubStatus -Status "success" -Description "All tests passed." -Context "$(Build.DefinitionName) (Test run)" - } env: BUILD_REVISION: $(Build.SourceVersion) CONTEXT: ${{ parameters.statusContext }}