Skip to content

Commit accdb83

Browse files
jfversluisCopilot
authored andcommitted
Separate snapshot diffs artifacts in CI (#31724)
* Update ui-tests-steps.yml * Fake test snapshot diff * Replace hardcoded tfm * Update ui-tests-steps.yml * Update ui-tests-steps.yml * Different approach * Update ui-tests.yml * Update ui-tests.yml * Update ui-tests.yml * Reusable template * Revert "Fake test snapshot diff" This reverts commit 99c982a. * Update eng/pipelines/common/ui-tests-collect-snapshot-diffs.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Also check files in subfolders --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> # Conflicts: # eng/pipelines/common/ui-tests.yml
1 parent 88c2c7a commit accdb83

File tree

3 files changed

+81
-81
lines changed

3 files changed

+81
-81
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
parameters:
2+
platform: '' # The platform name for logging (e.g., 'Android', 'iOS', 'Windows', 'Mac')
3+
artifactName: '' # The artifact name to publish (e.g., 'uitest-snapshot-results-android')
4+
5+
steps:
6+
- task: PowerShell@2
7+
condition: always()
8+
displayName: Check for ${{ parameters.platform }} snapshot diffs
9+
name: Check${{ replace(parameters.platform, ' ', '') }}Snapshots # NOTE: This step name must match the variable reference in the condition below
10+
inputs:
11+
targetType: 'inline'
12+
script: |
13+
$snapshotDiffPath = "$(Build.ArtifactStagingDirectory)/Controls.TestCases.Shared.Tests/snapshots-diff"
14+
Write-Host "Checking for ${{ parameters.platform }} snapshot diffs at: $snapshotDiffPath"
15+
16+
if (Test-Path $snapshotDiffPath) {
17+
$diffFiles = Get-ChildItem $snapshotDiffPath -File -Recurse
18+
19+
if ($diffFiles.Count -gt 0) {
20+
Write-Host "✅ Found $($diffFiles.Count) ${{ parameters.platform }} snapshot diff files in snapshots-diff directory"
21+
Write-Host "##vso[task.setvariable variable=snapshotsExist;isOutput=true]true"
22+
} else {
23+
Write-Host "ℹ️ snapshots-diff directory exists but no ${{ parameters.platform }} diff files found"
24+
Write-Host "##vso[task.setvariable variable=snapshotsExist;isOutput=true]false"
25+
}
26+
} else {
27+
Write-Host "❌ No ${{ parameters.platform }} snapshots-diff directory found at: $snapshotDiffPath"
28+
Write-Host "##vso[task.setvariable variable=snapshotsExist;isOutput=true]false"
29+
}
30+
31+
- task: PublishPipelineArtifact@1
32+
condition: eq(variables['Check${{ replace(parameters.platform, ' ', '') }}Snapshots.snapshotsExist'], 'true') # NOTE: This variable reference must match the step name above
33+
displayName: Publish ${{ parameters.platform }} snapshot diffs
34+
inputs:
35+
targetPath: $(Build.ArtifactStagingDirectory)/Controls.TestCases.Shared.Tests
36+
artifact: ${{ parameters.artifactName }}

eng/pipelines/common/ui-tests-steps.yml

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -175,90 +175,11 @@ steps:
175175
condition: always()
176176
displayName: publish artifacts
177177

178+
# Enable Notification Center re-enabled only for catalyst
178179
- ${{ if eq(parameters.platform, 'catalyst')}}:
179180
- bash: |
180181
chmod +x $(System.DefaultWorkingDirectory)/eng/scripts/enable-notification-center.sh
181182
$(System.DefaultWorkingDirectory)/eng/scripts/enable-notification-center.sh
182183
displayName: 'Enable Notification Center'
183184
continueOnError: true
184185
timeoutInMinutes: 60
185-
186-
- ${{ if eq(parameters.platform, 'android')}}:
187-
- task: PowerShell@2
188-
inputs:
189-
targetType: 'inline'
190-
script: |
191-
$folderPath = "${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.Android.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff"
192-
if (Test-Path $folderPath) {
193-
Write-Host "##vso[task.setvariable variable=androidFolderExists;isOutput=true]true"
194-
} else {
195-
Write-Host "##vso[task.setvariable variable=androidFolderExists;isOutput=true]false"
196-
}
197-
name: CheckAndroidFolderExists
198-
199-
- task: PublishBuildArtifacts@1
200-
condition: eq(variables['CheckAndroidFolderExists.androidFolderExists'], 'true')
201-
displayName: publish Android screenshots artifacts
202-
inputs:
203-
PathToPublish: ${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.Android.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff
204-
ArtifactName: uitest-snapshot-results-android
205-
206-
- ${{ if eq(parameters.platform, 'ios')}}:
207-
- task: PowerShell@2
208-
inputs:
209-
targetType: 'inline'
210-
script: |
211-
$folderPath = "${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.iOS.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff"
212-
if (Test-Path $folderPath) {
213-
Write-Host "##vso[task.setvariable variable=iosFolderExists;isOutput=true]true"
214-
} else {
215-
Write-Host "##vso[task.setvariable variable=iosFolderExists;isOutput=true]false"
216-
}
217-
name: CheckIosFolderExists
218-
219-
- task: PublishBuildArtifacts@1
220-
condition: eq(variables['CheckIosFolderExists.iosFolderExists'], 'true')
221-
displayName: publish iOS screenshots artifacts
222-
inputs:
223-
PathToPublish: ${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.iOS.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff
224-
ArtifactName: uitest-snapshot-results-ios
225-
226-
- ${{ if eq(parameters.platform, 'windows')}}:
227-
- task: PowerShell@2
228-
inputs:
229-
targetType: 'inline'
230-
script: |
231-
$folderPath = "${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.WinUI.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff"
232-
if (Test-Path $folderPath) {
233-
Write-Host "##vso[task.setvariable variable=windowsFolderExists;isOutput=true]true"
234-
} else {
235-
Write-Host "##vso[task.setvariable variable=windowsFolderExists;isOutput=true]false"
236-
}
237-
name: CheckWindowsFolderExists
238-
239-
- task: PublishBuildArtifacts@1
240-
condition: eq(variables['CheckWindowsFolderExists.windowsFolderExists'], 'true')
241-
displayName: publish Windows screenshots artifacts
242-
inputs:
243-
PathToPublish: ${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.WinUI.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff
244-
ArtifactName: uitest-snapshot-results-windows
245-
246-
- ${{ if eq(parameters.platform, 'catalyst')}}:
247-
- task: PowerShell@2
248-
inputs:
249-
targetType: 'inline'
250-
script: |
251-
$folderPath = "${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.Mac.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff"
252-
if (Test-Path $folderPath) {
253-
Write-Host "##vso[task.setvariable variable=macFolderExists;isOutput=true]true"
254-
} else {
255-
Write-Host "##vso[task.setvariable variable=macFolderExists;isOutput=true]false"
256-
}
257-
name: CheckMacFolderExists
258-
259-
- task: PublishBuildArtifacts@1
260-
condition: eq(variables['CheckMacFolderExists.macFolderExists'], 'true')
261-
displayName: publish Mac screenshots artifacts
262-
inputs:
263-
PathToPublish: ${{ parameters.checkoutDirectory }}/artifacts/bin/Controls.TestCases.Mac.Tests/${{ parameters.configuration }}/net9.0/snapshots-diff
264-
ArtifactName: uitest-snapshot-results-mac

eng/pipelines/common/ui-tests.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,14 @@ stages:
147147
provisionatorChannel: ${{ parameters.provisionatorChannel }}
148148
testFilter: $(CATEGORYGROUP)
149149
skipProvisioning: ${{ parameters.skipProvisioning }}
150-
150+
151+
# Collect and publish Android snapshot diffs
152+
- template: ui-tests-collect-snapshot-diffs.yml
153+
parameters:
154+
platform: 'Android'
155+
artifactName: 'uitest-snapshot-results-android-$(System.JobName)-$(System.JobAttempt)'
156+
157+
151158
- stage: android_ui_tests_coreclr
152159
displayName: Android UITests CoreClr
153160
dependsOn: build_ui_tests_coreclr
@@ -186,6 +193,12 @@ stages:
186193
testFilter: $(CATEGORYGROUP)
187194
skipProvisioning: ${{ parameters.skipProvisioning }}
188195
runtimeVariant: "CoreCLR"
196+
197+
# Collect and publish Android snapshot diffs
198+
- template: ui-tests-collect-snapshot-diffs.yml
199+
parameters:
200+
platform: 'Android'
201+
artifactName: 'uitest-snapshot-results-android-$(System.JobName)-$(System.JobAttempt)'
189202

190203
- stage: ios_ui_tests_mono
191204
displayName: iOS UITests Mono
@@ -227,6 +240,12 @@ stages:
227240
runtimeVariant : "Mono"
228241
testFilter: $(CATEGORYGROUP)
229242
skipProvisioning: ${{ parameters.skipProvisioning }}
243+
244+
# Collect and publish iOS snapshot diffs
245+
- template: ui-tests-collect-snapshot-diffs.yml
246+
parameters:
247+
platform: 'iOS'
248+
artifactName: 'uitest-snapshot-results-ios-$(System.JobName)-$(System.JobAttempt)'
230249

231250
- stage: ios_ui_tests_mono_cv2
232251
displayName: iOS UITests Mono CollectionView2
@@ -264,6 +283,12 @@ stages:
264283
testFilter: "CollectionView"
265284
testConfigurationArgs: "CollectionView2"
266285
skipProvisioning: ${{ parameters.skipProvisioning }}
286+
287+
# Collect and publish iOS CV2 snapshot diffs
288+
- template: ui-tests-collect-snapshot-diffs.yml
289+
parameters:
290+
platform: 'iOS CV2'
291+
artifactName: 'uitest-snapshot-results-ios-cv2-$(System.JobName)-$(System.JobAttempt)'
267292

268293
- stage: ios_ui_tests_mono_carv2
269294
displayName: iOS UITests Mono CarouselView2
@@ -301,6 +326,12 @@ stages:
301326
testFilter: "CarouselView"
302327
testConfigurationArgs: "CollectionView2"
303328
skipProvisioning: ${{ parameters.skipProvisioning }}
329+
330+
# Collect and publish iOS CARV2 snapshot diffs
331+
- template: ui-tests-collect-snapshot-diffs.yml
332+
parameters:
333+
platform: 'iOS CARV2'
334+
artifactName: 'uitest-snapshot-results-ios-carv2-$(System.JobName)-$(System.JobAttempt)'
304335

305336
# NativeAOT iOS UI tests stage - only run when both BuildNativeAOT and RunNativeAOT parameters are true
306337
- ${{ if and(eq(parameters.BuildNativeAOT, true), eq(parameters.RunNativeAOT, true)) }}:
@@ -375,6 +406,12 @@ stages:
375406
provisionatorChannel: ${{ parameters.provisionatorChannel }}
376407
testFilter: $(CATEGORYGROUP)
377408
skipProvisioning: ${{ parameters.skipProvisioning }}
409+
410+
# Collect and publish Windows snapshot diffs
411+
- template: ui-tests-collect-snapshot-diffs.yml
412+
parameters:
413+
platform: 'Windows'
414+
artifactName: 'uitest-snapshot-results-windows-$(System.JobName)-$(System.JobAttempt)'
378415

379416
- stage: mac_ui_tests
380417
displayName: macOS UITests
@@ -407,3 +444,9 @@ stages:
407444
provisionatorChannel: ${{ parameters.provisionatorChannel }}
408445
testFilter: $(CATEGORYGROUP)
409446
skipProvisioning: ${{ parameters.skipProvisioning }}
447+
448+
# Collect and publish Mac snapshot diffs
449+
- template: ui-tests-collect-snapshot-diffs.yml
450+
parameters:
451+
platform: 'Mac'
452+
artifactName: 'uitest-snapshot-results-mac-$(System.JobName)-$(System.JobAttempt)'

0 commit comments

Comments
 (0)