1+ name : $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr)
2+
3+ # https://aka.ms/obpipelines/triggers
4+ trigger : none
5+
6+ parameters : # parameters are shown up in ADO UI in a build queue time
7+ - name : ' debug'
8+ displayName : ' Enable debug output'
9+ type : boolean
10+ default : false
11+
12+ variables :
13+ CDP_DEFINITION_BUILD_COUNT : $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
14+ system.debug : ${{ parameters.debug }}
15+ ENABLE_PRS_DELAYSIGN : 1
16+ ROOT : $(Build.SourcesDirectory)
17+ REPOROOT : $(Build.SourcesDirectory)
18+ OUTPUTROOT : $(REPOROOT)\out
19+ NUGET_XMLDOC_MODE : none
20+
21+ # Docker image which is used to build the project https://aka.ms/obpipelines/containers
22+ WindowsContainerImage : ' onebranch.azurecr.io/windows/ltsc2019/vse2022:latest'
23+
24+ Codeql.Enabled : true # CodeQL once every 3 days on the default branch for all languages its applicable to in that pipeline.
25+
26+ resources :
27+ repositories :
28+ - repository : templates
29+ type : git
30+ name : OneBranch.Pipelines/GovernedTemplates
31+ ref : refs/heads/main
32+
33+ extends :
34+ template : v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
35+ parameters :
36+ platform :
37+ name : ' windows_undocked'
38+
39+ globalSdl : # Refer the wiki for more options in this parameter: https://aka.ms/obpipelines/sdl
40+ tsa :
41+ enabled : false # onebranch publish all sdl results to TSA. If TSA is disabled all SDL tools will forced into 'break' build mode.
42+ # suppression:
43+ # suppressionFile: $(Build.SourcesDirectory)\.gdn\global.gdnsuppress
44+ featureFlags :
45+ ensureArtifactsDirExists : true
46+
47+ stages :
48+ - stage : build
49+ jobs :
50+ - job : main
51+ pool :
52+ # read more about custom job pool types at https://aka.ms/obpipelines/yaml/jobs
53+ pool :
54+ type : windows
55+ isCustom : true
56+ name : Azure Pipelines
57+ vmImage : ' windows-latest'
58+
59+ variables :
60+ ob_outputDirectory : $(build.artifactStagingDirectory)
61+ ob_artifactSuffix : _$(buildPlatform)_$(buildConfiguration)
62+
63+ solutionGallery : " **/WinUIGallery.sln"
64+ solutionUITests : " **/UITests.sln"
65+ buildPlatform : " x64"
66+ buildConfiguration : " Debug"
67+ appxPackageDir : ' $(Build.ArtifactStagingDirectory)\AppxPackages\\'
68+
69+ steps :
70+ # Package Restore
71+ - task : NuGetToolInstaller@1
72+ displayName : Install NuGet 5.8.0
73+ inputs :
74+ versionSpec : 5.8.0
75+
76+ - task : NuGetCommand@2
77+ displayName : Restore NuGet Packages for WinUI Gallery
78+ inputs :
79+ command : ' restore'
80+ restoreSolution : ' **/*.sln'
81+ feedsToUse : ' config'
82+ nugetConfigPath : ' $(System.DefaultWorkingDirectory)\nuget.config'
83+
84+ - task : UseDotNet@2
85+ continueOnError : true
86+ inputs :
87+ packageType : ' sdk'
88+ performMultiLevelLookup : true
89+
90+ # Signing
91+ - task : PowerShell@2
92+ displayName : Generate Test Signing Certificate
93+ inputs :
94+ targetType : filePath
95+ filePath : build/GenerateTestPFX.ps1
96+
97+ # Build (Product)
98+ - task : DotNetCoreCLI@2
99+ displayName : Build WinUI Gallery Package
100+ inputs :
101+ command : ' publish'
102+ publishWebProjects : false
103+ projects : ' $(solutionGallery)'
104+ arguments : ' /p:AppxPackageDir="$(appxPackageDir)" /p:platform="$(buildPlatform)" /p:configuration="$(buildConfiguration)" /p:PublishProfile="./WinUIGallery/Properties/PublishProfiles/win-$(buildPlatform).pubxml"'
105+ zipAfterPublish : false
106+ modifyOutputPath : false
107+
108+ - script : |
109+ dir /b /s $(Build.ArtifactStagingDirectory)
110+ dir /b /s $(System.DefaultWorkingDirectory)
111+ displayName: 'List contents of ArtifactStagingDirectory and DefaultWorkingDirectory'
112+
113+ # Install and Run Unit Tests
114+ - task : VSTest@2
115+ displayName : ' Run Sample Unit Tests'
116+ inputs :
117+ testSelector : " testAssemblies"
118+ searchFolder : " $(System.DefaultWorkingDirectory)"
119+ failOnMinTestsNotRun : true
120+ minimumExpectedTests : ' 3'
121+ testAssemblyVer2 : |
122+ **\WinUIGalleryUnitTests.build.appxrecipe
123+
124+ # Build and Run UI Tests
125+ - task : PowerShell@2
126+ displayName : Install WinUI Gallery Package
127+ inputs :
128+ targetType : " inline"
129+ script : |
130+ cd $(appxPackageDir)
131+
132+ $AppBundle = Get-ChildItem -Filter WinUIGallery*Test -Name
133+ cd $AppBundle
134+
135+ .\Install.ps1 -Certificate WinUIGallery.Desktop.cer -Force
136+ errorActionPreference : " continue"
137+ failOnStderr : true
138+ workingDirectory : " $(System.DefaultWorkingDirectory)"
139+
140+ - task : NuGetCommand@2
141+ displayName : Restore Packages for UI Tests Project
142+ inputs :
143+ restoreSolution : " $(solutionUITests)"
144+
145+ - task : VSBuild@1
146+ displayName : Build UI Tests Project
147+ inputs :
148+ platform : " $(buildPlatform)"
149+ solution : " $(solutionUITests)"
150+ configuration : " $(buildConfiguration)"
151+ - task : Windows Application Driver@0
152+ displayName : Start Windows Application Driver
153+ inputs :
154+ OperationType : " Start"
155+ AgentResolution : " 1080p"
156+ WADArguments : " 4724"
157+
158+ - task : VSTest@2
159+ displayName : Run UI Tests
160+ inputs :
161+ testSelector : " testAssemblies"
162+ testAssemblyVer2 : |
163+ **\UITests.dll
164+ !**\*TestAdapter.dll
165+ !**\obj\**
166+ !**\ref\**
167+ platform : ' $(buildPlatform)'
168+ configuration : " $(buildConfiguration)"
169+ searchFolder : " $(System.DefaultWorkingDirectory)"
170+
171+ - task : Windows Application Driver@0
172+ displayName : Stop Windows Application Driver
173+ inputs :
174+ OperationType : " Stop"
175+
176+ - task : PublishPipelineArtifact@1
177+ inputs :
178+ targetPath : $(ob_outputDirectory)
179+ artifact : ' drop_build_main_$(buildPlatform)_$(buildConfiguration)'
180+ publishLocation : ' pipeline'
181+
182+
0 commit comments