diff --git a/tools/devops/automation/templates/common/configure.yml b/tools/devops/automation/templates/common/configure.yml index 778c898de0..1efee17a52 100644 --- a/tools/devops/automation/templates/common/configure.yml +++ b/tools/devops/automation/templates/common/configure.yml @@ -96,7 +96,8 @@ steps: "trigger-device-tests", "run-sample-tests", "skip-packaged-xamarin-mac-tests", - "skip-api-comparison" + "skip-api-comparison", + "skip-all-tests" ) foreach ($l in $labelsOfInterest) { diff --git a/tools/devops/automation/templates/tests/stage.yml b/tools/devops/automation/templates/tests/stage.yml index 4a5fdd6d23..d0a0b39787 100644 --- a/tools/devops/automation/templates/tests/stage.yml +++ b/tools/devops/automation/templates/tests/stage.yml @@ -103,6 +103,8 @@ stages: - ${{ each label in parameters.simTestsConfigurations }}: - job: "tests_${{ replace(label, '-', '_') }}" + ${{ if eq(parameters.parseLabels, true) }}: + condition: eq(dependencies.configure.outputs['labels.skip-all-tests'], '') dependsOn: - ${{ if eq(parameters.parseLabels, true) }}: - configure @@ -144,13 +146,18 @@ stages: gitHubToken: ${{ parameters.gitHubToken }} xqaCertPass: ${{ parameters.xqaCertPass }} - - job: publish_html - displayName: 'Publish Html report in VSDrops' + - job: publish_test_results + ${{ if eq(parameters.parseLabels, true) }}: + condition: and(eq(dependencies.configure.outputs['labels.skip-all-tests'], ''), succeededOrFailed()) + ${{ else }}: + condition: succeededOrFailed() + displayName: 'GitHub comment - Publish results' timeoutInMinutes: 1000 dependsOn: # has to wait for the tests to be done AND the data to be uploaded + - ${{ if eq(parameters.parseLabels, true) }}: + - configure - ${{ each label in parameters.simTestsConfigurations }}: - tests_${{ replace(label, '-', '_') }} - condition: succeededOrFailed() variables: ${{ each label in parameters.simTestsConfigurations }}: # Define the variable FOO from the previous job @@ -169,3 +176,33 @@ stages: statusContext: ${{ parameters.statusContext }} vsdropsPrefix: ${{ parameters.vsdropsPrefix }} testPrefix: ${{ parameters.testPrefix }} + + - job: publish_skipped_tests + ${{ if eq(parameters.parseLabels, true) }}: + condition: ne(dependencies.configure.outputs['labels.skip-all-tests'], '') + ${{ else }}: + condition: false + displayName: 'GitHub comment - Skipped tests' + timeoutInMinutes: 1000 + dependsOn: # has to wait for the tests to be done AND the data to be uploaded + - configure + + pool: + vmImage: 'windows-latest' + workspace: + clean: all + + steps: + - pwsh: | + Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1 + + $gihubComments = New-GitHubCommentsObject -Org "xamarin" -Repo "xamarin-macios" -Token $Env:GITHUB_TOKEN -Hash $Env:GIT_HASH -Debug + $sb = [System.Text.StringBuilder]::new() + $sb.AppendLine("All tests have been skipped because the label 'skip-all-tests' was set.") + $result = $gihubComments.NewCommentFromMessage("Test results", ":seedling:", $sb.ToString()) + displayName: 'Set comment' + env: + CONTEXT: ${{ parameters.statusContext }} + DEVICE_PREFIX: ${{ parameters.testPrefix }} + GITHUB_TOKEN: $(GitHub.Token) + ACCESSTOKEN: $(System.AccessToken)