Microsoft.Maui.Graphics/azure-pipelines.yml

269 строки
11 KiB
YAML

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'
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'
condition: and(succeeded(), ${{ variables['signingCondition'] }} ) # Executed when signing is enabled such as for continuous integration builds (CIs)