[CI] Allow to skip all tests in the parallel implementation. (#15334)

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
Manuel de la Pena 2022-06-29 15:27:03 -04:00 коммит произвёл GitHub
Родитель a5f72dda33
Коммит 8bd19e5514
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 42 добавлений и 4 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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)