1
+ parameters :
2
+ - name : " SignOutput"
3
+ type : boolean
4
+ default : false
5
+
6
+ stages :
7
+ - stage : StaticValidationTest
8
+ dependsOn : Pack
9
+ condition : not(failed())
10
+ jobs :
11
+ - job : StaticValidationTest
12
+ pool :
13
+ type : windows
14
+ isCustom : true
15
+ name : ' ProjectReunionESPool-2022' # This stage is purely for ES, hence this custom pool
16
+ timeoutInMinutes : 120
17
+ steps :
18
+ - task : NuGetToolInstaller@1
19
+ - task : NuGetAuthenticate@1
20
+
21
+ - task : powershell@2
22
+ displayName : ' DevCheck: Setup/Verify development environment'
23
+ inputs :
24
+ targetType : filePath
25
+ filePath : tools\DevCheck\DevCheck.ps1
26
+ arguments : -NoInteractive -Offline -Verbose -CheckTestPfx -Clean -CheckDependencies -ShowSystemInfo
27
+ workingDirectory : ' $(Build.SourcesDirectory)'
28
+
29
+ - task : DownloadPipelineArtifact@2
30
+ displayName : ' Download Foundation'
31
+ inputs :
32
+ source : specific
33
+ runVersion : specific
34
+ project : $(System.TeamProjectId)
35
+ pipeline : $(_useBuildOutputFromPipeline)
36
+ pipelineId : $(_useBuildOutputFromBuildId)
37
+ artifactName : " TransportPackage"
38
+ targetPath : $(System.ArtifactsDirectory)
39
+
40
+ - task : CopyFiles@2
41
+ inputs :
42
+ SourceFolder : ' $(System.ArtifactsDirectory)'
43
+ Contents : |
44
+ **/*.nupkg
45
+ targetFolder : $(Build.SourcesDirectory)\localpackages
46
+
47
+ - task : PowerShell@2
48
+ name : ExtractWindowsAppSDKVersion
49
+ displayName : Extract WindowsAppSDKVersion
50
+ inputs :
51
+ targetType : ' inline'
52
+ script : |
53
+ $files = Get-ChildItem "$(Build.SourcesDirectory)\localpackages" -Filter "*Microsoft.WindowsAppSDK.Foundation.TransportPackage*.nupkg"
54
+ Write-Host $files.Count
55
+ if ($files.Count -eq 1)
56
+ {
57
+ Write-Host "file:" $files.FullName
58
+ $version = (($files.FullName -Split "Microsoft.WindowsAppSDK.Foundation.TransportPackage.")[1] -Split ".nupkg")[0]
59
+ Write-Host "|$version|"
60
+ Write-Host "##vso[task.setvariable variable=FoundationVersion]$version"
61
+ }
62
+ else
63
+ {
64
+ Write-Host "Error: Found more than one Foundation TransportPackage Found"
65
+ Write-Host "Please make sure only one package is present"
66
+ Write-Host "##vso[task.complete result=Failed;]DONE"
67
+ }
68
+
69
+ - task : VSBuild@1
70
+ displayName : ' Restore PackageInspectionTest.sln'
71
+ inputs :
72
+ solution : $(Build.SourcesDirectory)\test\StaticValidationTests\PackageInspectionTest.csproj
73
+ msbuildArgs : /t:restore /p:FoundationVersion="$(FoundationVersion)" /p:RestoreAdditionalProjectSources="$(Build.SourcesDirectory)\localpackages"
74
+
75
+ - task : VSBuild@1
76
+ displayName : ' Build PackageInspectionTest.sln'
77
+ inputs :
78
+ solution : $(Build.SourcesDirectory)\test\StaticValidationTests\PackageInspectionTest.csproj
79
+
80
+ - script : |
81
+ dir /s $(Build.SourcesDirectory)\Packages
82
+
83
+ - task : PowerShell@2
84
+ displayName : ' Run PackageInspectionTests'
85
+ inputs :
86
+ targetType : ' inline'
87
+ ignoreLASTEXITCODE : true
88
+ script : |
89
+ $KitsRoot10 = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name KitsRoot10).KitsRoot10
90
+ $WindowsSdkBinDir = Join-Path $KitsRoot10 "bin\10.0.22000.0\x86"
91
+
92
+ $path = "$(Build.SourcesDirectory)\Packages\Microsoft.WindowsAppSDK.Foundation.TransportPackage\$(FoundationVersion)"
93
+ $buildtype = '$(channel)'
94
+ $log = "$(Build.ArtifactStagingDirectory)\PackageInspectionResults.txt"
95
+ $checksigning = ""
96
+ if ('${{ parameters.SignOutput }}' -eq 'true')
97
+ {
98
+ $checksigning = "--checksigning"
99
+ }
100
+
101
+ $testargs = "--packagepath=`"$path`" --buildtype=$buildtype --logfilepath=`"$log`" --windowssdkbindir=`"$WindowsSdkBinDir`" $checksigning"
102
+ $cmd = "`"$(Build.SourcesDirectory)\BuildOutput\PackageInspectionTest\PackageInspectionTest.exe`" $testargs"
103
+ Write-Host $cmd
104
+ cmd /c $cmd
105
+
106
+ Write-Host "results " $LASTEXITCODE
107
+ if ($LASTEXITCODE -ne 0)
108
+ {
109
+ # Only fail if we are not on the main branch
110
+ if ('$(Build.SourceBranch)' -eq 'refs/heads/main')
111
+ {
112
+ Write-Host "##vso[task.complete result=SucceededWithIssues;]DONE"
113
+ }
114
+ else
115
+ {
116
+ Write-Host "##vso[task.complete result=Failed;]DONE"
117
+ }
118
+ }
0 commit comments