@@ -19,6 +19,10 @@ resources:
1919 ref : refs/heads/main
2020 endpoint : xamarin
2121
22+ parameters :
23+ - name : ApiScanSourceBranch
24+ default : refs/heads/main
25+
2226variables :
2327- name : TeamName
2428 value : XamarinAndroid
@@ -241,3 +245,66 @@ stages:
241245 TargetFolders : $(Build.SourcesDirectory)\artifacts
242246 ExcludeSNVerify : true
243247 condition : and(succeededOrFailed(), eq(variables['MicroBuildSignType'], 'Real'))
248+
249+ - stage : compliance_scan
250+ displayName : Compliance
251+ dependsOn : build
252+ condition : and(eq(dependencies.build.result, 'Succeeded'), eq(variables['Build.SourceBranch'], '${{ parameters.ApiScanSourceBranch }}'))
253+ jobs :
254+ - job : api_scan
255+ displayName : API Scan
256+ pool :
257+ name : Azure Pipelines
258+ vmImage : windows-2022
259+ timeoutInMinutes : 480
260+ workspace :
261+ clean : all
262+ steps :
263+ - task : DownloadPipelineArtifact@2
264+ inputs :
265+ artifactName : artifacts-windows-unsigned
266+ downloadPath : $(Build.SourcesDirectory)\artifacts
267+
268+ - task : CopyFiles@2
269+ displayName : Collect Files for APIScan
270+ inputs :
271+ Contents : |
272+ $(Build.SourcesDirectory)\artifacts\**\?(*.dll|*.exe|*.pdb)
273+ TargetFolder : $(Build.StagingDirectory)\apiscan
274+
275+ - powershell : Get-ChildItem -Path "$(Build.StagingDirectory)\apiscan" -Recurse
276+ displayName : List Files for APIScan
277+
278+ - task : APIScan@2
279+ displayName : Run APIScan
280+ inputs :
281+ softwareFolder : $(Build.StagingDirectory)\apiscan
282+ symbolsFolder : ' SRV*http://symweb;$(Build.StagingDirectory)\apiscan'
283+ softwareName : $(ApiScanName)
284+ softwareVersionNum : $(Build.SourceBranchName)-$(Build.SourceVersion)
285+ isLargeApp : true
286+ toolVersion : Latest
287+ env :
288+ AzureServicesAuthConnectionString : runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)
289+
290+ - task : SdtReport@2
291+ displayName : Guardian Export - Security Report
292+ inputs :
293+ GdnExportAllTools : false
294+ GdnExportGdnToolApiScan : true
295+ GdnExportOutputSuppressionFile : source.gdnsuppress
296+
297+ - task : PublishSecurityAnalysisLogs@3
298+ displayName : Publish Guardian Artifacts
299+ inputs :
300+ ArtifactName : APIScan Logs
301+ ArtifactType : Container
302+ AllTools : false
303+ APIScan : true
304+ ToolLogsNotFoundAction : Warning
305+
306+ - task : PostAnalysis@2
307+ displayName : Fail Build on Guardian Issues
308+ inputs :
309+ GdnBreakAllTools : false
310+ GdnBreakGdnToolApiScan : true
0 commit comments