This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
/
azure-pipelines.yml
270 lines (244 loc) · 11.1 KB
/
azure-pipelines.yml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
variables:
BuildVersion: $[counter('release-counter', 1)]
IsRunningOnCI: true
DotNet.Cli.Telemetry.OptOut: true
provisionator.path: '$(System.DefaultWorkingDirectory)/eng/provisioning/provisioning.csx'
provisionator.vs: '$(System.DefaultWorkingDirectory)/eng/provisioning/vs.csx'
provisionator.extraArguments: '--v'
signingCondition: or(eq(variables['Sign'], 'true'),
or(eq(variables['Build.SourceBranch'], 'refs/heads/main'),
or(startsWith(variables['Build.SourceBranch'],'refs/tags/'), startsWith(variables['Build.SourceBranch'],'refs/heads/release/') )
)
)
parameters:
- name: BuildConfigurations
type: object
default:
- name: Debug
poolName: $(windowsNet6VmPool)
vmImage: $(windowsNet6VmImage)
- name: Release
poolName: $(windowsNet6VmPool)
vmImage: $(windowsNet6VmPool)
trigger:
branches:
include:
- main
- release/*
- darc-*
tags:
include:
- '*'
paths:
include:
- '*'
exclude:
- .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
- LICENSE.TXT
- PATENTS.TXT
- README.md
- SECURITY.md
- THIRD-PARTY-NOTICES.TXT
pr:
branches:
include:
- main
- release/*
paths:
include:
- '*'
exclude:
- .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
- LICENSE.TXT
- PATENTS.TXT
- README.md
- SECURITY.md
- THIRD-PARTY-NOTICES.TXT
resources:
repositories:
- repository: xamarin-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
ref: refs/heads/main
stages:
- stage: windows
displayName: Build Windows
jobs:
- ${{ each BuildConfiguration in parameters.BuildConfigurations }}:
- job: win_hosted_${{ BuildConfiguration.name }}
workspace:
clean: all
displayName: Build Windows Phase (${{ BuildConfiguration.name }})
timeoutInMinutes: 60
pool:
name: ${{ BuildConfiguration.poolName }}
vmImage: ${{ BuildConfiguration.vmImage }}
steps:
- template: /eng/pipelines/common/provision.yml
parameters:
platform: 'windows'
- task: NuGetToolInstaller@0
displayName: install new nuget
inputs:
versionSpec: '5.x'
- pwsh: |
$DOTNET_ROOT = "$env:ProgramFiles\dotnet"
$env:DOTNET_ROOT = $DOTNET_ROOT
echo "##vso[task.setvariable variable=DOTNET_ROOT]$DOTNET_ROOT"
displayName: set up the .NET root envvar
errorActionPreference: stop
- pwsh: dotnet tool restore
displayName: install dotnet tools
- pwsh: |
[xml] $fileXml = Get-Content "eng\Versions.props"
$DotNetVersion = $fileXml.SelectSingleNode("Project/PropertyGroup/MicrosoftDotnetSdkInternalPackageVersion").InnerText
$DotNetVersionBand = $fileXml.SelectSingleNode("Project/PropertyGroup/DotNetVersionBand").InnerText
echo "Installing .NET $DotNetVersion"
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
& .\dotnet-install.ps1 -Version $DotNetVersion -InstallDir "$env:DOTNET_ROOT" -Verbose
echo "Removing signing"
& "${env:ProgramFiles(x86)}\Windows Kits\10\App Certification Kit\signtool.exe" remove /s "$env:DOTNET_ROOT\sdk\$DotNetVersionBand\dotnet.dll"
echo "Listing installed SDKs"
& dotnet --list-sdks
displayName: install .NET
errorActionPreference: stop
- pwsh: ./build.ps1 --target=dotnet-local-workloads --configuration="${{ BuildConfiguration.name }}" --verbosity=diagnostic --installdotnet=false
displayName: 'install .NET workloads'
retryCountOnTaskFailure: 3
env:
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
PRIVATE_BUILD: $(PrivateBuild)
- pwsh: |
[xml] $fileXml = Get-Content "eng\Versions.props"
$DotNetVersionBand = $fileXml.SelectSingleNode("Project/PropertyGroup/DotNetVersionBand").InnerText
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
.\workload-install.ps1 -DotnetTargetVersionBand $DotNetVersionBand
displayName: install tizen
- pwsh: |
$uri = 'https://go.microsoft.com/fwlink/?linkid=2083338'
Invoke-WebRequest -Uri $uri -OutFile winsdksetup.exe
.\winsdksetup.exe /norestart /quiet | Out-Null
dir "C:\Program Files (x86)\Windows Kits\10\References\"
displayName: install Windows 10 SDK, version 1903 (10.0.18362.1)
condition: eq(variables['provisioningWindowsSdk'], 'true')
- pwsh: |
# $VS_ROOT = (& dotnet vs where --prop=InstallationPath)[0]
$VS_ROOT = 'C:\Program Files\Microsoft Visual Studio\2022\Preview'
echo "##vso[task.setvariable variable=VS_ROOT]$VS_ROOT"
$MSBUILD_EXE = "$VS_ROOT\MSBuild\Current\Bin\MSBuild.exe"
echo "##vso[task.setvariable variable=MSBUILD_EXE]$MSBUILD_EXE"
echo "Using MSBuild: $MSBUILD_EXE"
displayName: set up the msbuild envvar
errorActionPreference: stop
- pwsh: |
& $env:MSBUILD_EXE /r /m ./build/Build.Microsoft.Maui.Graphics.Windows.sln /p:Configuration=${{ BuildConfiguration.name }} /bl:$(Build.ArtifactStagingDirectory)/${{ BuildConfiguration.name }}.binlog
displayName: build classic solutions
- pwsh: |
& $env:MSBUILD_EXE /r /m ./Microsoft.Maui.Graphics-net6.sln /p:Configuration=${{ BuildConfiguration.name }} /bl:$(Build.ArtifactStagingDirectory)/${{ BuildConfiguration.name }}-net6.binlog
displayName: build net6 solutions
- task: NuGetCommand@2
displayName: 'Pack nupkg'
inputs:
command: 'pack'
packagesToPack: '**\Microsoft.Maui.*.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)/${{ BuildConfiguration.name }}'
configuration: ${{ BuildConfiguration.name }}
basePath: '$(System.DefaultWorkingDirectory)'
versioningScheme : 'byEnvVar'
versionEnvVar: 'BUILD_BUILDNUMBER'
- task: CopyFiles@2
displayName: 'Copy SignList.xml and Packages'
inputs:
Contents: |
**/SignList.xml
TargetFolder: '$(Build.ArtifactStagingDirectory)/${{ BuildConfiguration.name }}'
flattenFolders: true
- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts
inputs:
ArtifactName: nuget
# only sign using the private server
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- stage: nuget_signing
dependsOn: windows
displayName: Sign Nuget
jobs:
- template: sign-artifacts/jobs/v2.yml@xamarin-templates
parameters:
signType: Real
teamName: Maui
usePipelineArtifactTasks: false
targetFolder: $(Build.ArtifactStagingDirectory)/nuget/signed
artifactPath: release
signedArtifactName: nuget
signedArtifactPath: signed
displayName: Sign Phase
condition: and(succeeded(), ${{ variables['signingCondition'] }} )
- job: push_signed_nugets
displayName: Push To Maestro
dependsOn: signing
condition: eq(dependencies.signing.result, 'Succeeded')
timeoutInMinutes: 60
pool: VSEngSS-MicroBuild2022-1ES
workspace:
clean: all
variables:
- group: Publish-Build-Assets
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
displayName: Download Signed Packages
inputs:
artifactName: nuget
downloadPath: $(Build.StagingDirectory)\nuget
patterns: |
**/signed/*.nupkg
- powershell: >-
& dotnet build -v:n
-t:PushManifestToBuildAssetRegistry
-p:BuildAssetRegistryToken=$(MaestroAccessToken)
-p:OutputPath=$(Build.StagingDirectory)\nuget\signed\
$(System.DefaultWorkingDirectory)\build\DotNet\Dependencies\Workloads.csproj
displayName: generate and publish BAR manifest
condition: and(succeeded(), eq(variables['PushPackageInfoToMaestro'], 'true'))
- powershell: |
$versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16'
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content
$arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
& dotnet tool update microsoft.dotnet.darc --version "$darcVersion" --add-source "$arcadeServicesSource" --tool-path $(Agent.ToolsDirectory)\darc -v n
& $(Agent.ToolsDirectory)\darc\darc add-build-to-channel --default-channels --id $(BARBuildId) --publishing-infra-version 3 --skip-assets-publishing --password $(MaestroAccessToken) --azdev-pat $(publishing-dnceng-devdiv-code-r-build-re)
displayName: add build to default darc channel
condition: and(succeeded(), eq(variables['PushPackageInfoToMaestro'], 'true'))
- stage: sbom
displayName: 'Software Bill of Materials'
dependsOn: [ 'windows', 'nuget_signing' ]
condition: succeeded('windows')
jobs:
- template: compliance/sbom/job.v1.yml@xamarin-templates
parameters:
jobName: SBOM_PR
jobDisplayName: 'Software Bill of Materials (PR)'
artifactNames: ['nuget']
artifactMap: ['nuget/Release']
packageName: 'Microsoft Maui Graphics'
packageFilter: '*.nupkg'
enableSBOMSigning: false
condition: not(${{ variables['signingCondition'] }}) # Executed when signing is not enabled such as for pull request builds (PRs)
- template: compliance/sbom/job.v1.yml@xamarin-templates
parameters:
jobName: SBOM_CI
jobDisplayName: 'Software Bill of Materials (CI)'
artifactNames: ['nuget']
artifactMap: ['nuget/signed']
packageName: 'Microsoft Maui Graphics'
packageFilter: '*.nupkg'
enableSBOMSigning: false
condition: and(succeeded(), ${{ variables['signingCondition'] }} ) # Executed when signing is enabled such as for continuous integration builds (CIs)