-
Notifications
You must be signed in to change notification settings - Fork 27
/
azure-pipelines.yaml
154 lines (134 loc) · 4.3 KB
/
azure-pipelines.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: android-tools $(Rev:r)
trigger:
- main
- release/*
pr:
- main
- release/*
parameters:
- name: ApiScanSourceBranch
default: refs/heads/main
# Global variables
variables:
- name: DotNetCoreVersion
value: 6.0.x
jobs:
- job: build
displayName: Build and Test
timeoutInMinutes: 60
strategy:
matrix:
macOS:
vmImage: macOS-13
windows:
vmImage: windows-2022
Codeql.Enabled: true
pool:
vmImage: $(vmImage)
workspace:
clean: all
steps:
- checkout: self
clean: true
- task: UseDotNet@2
displayName: Use .NET Core $(DotNetCoreVersion)
inputs:
version: $(DotNetCoreVersion)
- task: UseDotNet@2
displayName: Use .NET Core 8.0.x
inputs:
version: 8.0.x
- task: DotNetCoreCLI@2
displayName: Build solution Xamarin.Android.Tools.sln
inputs:
projects: Xamarin.Android.Tools.sln
arguments: -bl:$(Build.ArtifactStagingDirectory)/build.binlog
- task: DotNetCoreCLI@2
displayName: Run Tests
inputs:
command: test
projects: bin/TestDebug-net*/**/*-Tests.dll
- powershell: |
$hashOfLastVersionChange = & "git" "log" "--follow" "-1" "--pretty=%H" "nuget.version"
$commitsSinceVersionChange = & "git" "rev-list" "--count" "$hashOfLastVersionChange..HEAD"
$majorMinor = Get-Content "nuget.version"
$version = "$majorMinor.$commitsSinceVersionChange"
Write-Host "##vso[task.setvariable variable=xat.nuget.version]$version"
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
- task: DotNetCoreCLI@2
displayName: Build NuGet
inputs:
command: custom
projects: src/Xamarin.Android.Tools.AndroidSdk/Xamarin.Android.Tools.AndroidSdk.csproj
custom: pack
arguments: -p:Version=$(xat.nuget.version) -p:PackageOutputPath=$(Build.ArtifactStagingDirectory) -bl:$(Build.ArtifactStagingDirectory)/pack.binlog
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
- task: PublishPipelineArtifact@1
displayName: Upload Build Output
inputs:
path: bin/Debug
artifactName: Output - $(System.JobName)
- task: PublishPipelineArtifact@1
displayName: Upload Artifacts
inputs:
path: $(Build.ArtifactStagingDirectory)
artifactName: Artifacts - $(System.JobName)
condition: always()
- job: api_scan
displayName: API Scan
dependsOn: build
condition: false
#condition: and(eq(dependencies.build.result, 'Succeeded'), eq(variables['Build.SourceBranch'], '${{ parameters.ApiScanSourceBranch }}'))
pool:
name: Azure Pipelines
vmImage: windows-2022
timeoutInMinutes: 480
workspace:
clean: all
steps:
- task: DownloadPipelineArtifact@2
displayName: Download build artifacts
inputs:
artifactName: Output - windows
downloadPath: $(Build.SourcesDirectory)
- task: CopyFiles@2
displayName: Collect Files for APIScan
inputs:
Contents: |
$(Build.SourcesDirectory)\**\?(*.dll|*.exe|*.pdb)
!$(Build.SourcesDirectory)\**\ls-jdks.*
TargetFolder: $(Build.StagingDirectory)\apiscan
OverWrite: true
flattenFolders: true
- powershell: Get-ChildItem -Path "$(Build.StagingDirectory)\apiscan" -Recurse
displayName: List Files for APIScan
- task: APIScan@2
displayName: Run APIScan
inputs:
softwareFolder: $(Build.StagingDirectory)\apiscan
symbolsFolder: 'SRV*http://symweb;$(Build.StagingDirectory)\apiscan'
softwareName: $(ApiScanName)
softwareVersionNum: $(Build.SourceBranchName)-$(Build.SourceVersion)$(System.JobAttempt)
isLargeApp: true
toolVersion: Latest
env:
AzureServicesAuthConnectionString: runAs=App;AppId=$(ApiScanClientId);TenantId=$(ApiScanTenant);AppKey=$(ApiScanSecret)
- task: SdtReport@2
displayName: Guardian Export - Security Report
inputs:
GdnExportAllTools: false
GdnExportGdnToolApiScan: true
GdnExportOutputSuppressionFile: source.gdnsuppress
- task: PublishSecurityAnalysisLogs@3
displayName: Publish Guardian Artifacts
inputs:
ArtifactName: APIScan Logs
ArtifactType: Container
AllTools: false
APIScan: true
ToolLogsNotFoundAction: Warning
- task: PostAnalysis@2
displayName: Fail Build on Guardian Issues
inputs:
GdnBreakAllTools: false
GdnBreakGdnToolApiScan: true