maui/eng/pipelines/handlers.yml

357 строки
12 KiB
YAML

trigger:
branches:
include:
- main
- release/*
- net9.0
- net8.0
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/*
- net9.0
- net8.0
- net9.0
paths:
include:
- '*'
exclude:
- .github/*
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
- LICENSE.TXT
- PATENTS.TXT
- README.md
- SECURITY.md
- THIRD-PARTY-NOTICES.TXT
variables:
- template: /eng/pipelines/common/variables.yml
- template: templates/common/vs-release-vars.yml@sdk-insertions
parameters:
- name: UseProvisionator
type: boolean
default: false
- name: provisionatorChannel
displayName: 'Provisionator channel'
type: string
default: 'latest' # Support for launching a build against a Provisionator PR (e.g., pr/[github-account-name]/[pr-number]) as a means to test in-progress Provisionator changes
- name: BuildEverything
type: boolean
default: false
- name: BuildConfigurations
type: object
default:
- Debug
- Release
- name: BuildPlatforms
type: object
default:
- name: Windows
poolName: $(windowsVmPool)
vmImage: $(windowsVmImage)
demands:
- Agent.OS -equals Windows_NT
artifact: build-windows
- name: macOS
poolName: $(macOSXVmPool)
vmImage: $(macOSXVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals x64
artifact: build-macos
- name: PackPlatforms
type: object
default:
- name: Windows
poolName: $(windowsVmPool)
vmImage: $(windowsVmImage)
demands:
- Agent.OS -equals Windows_NT
artifact: nuget
- name: macOS
poolName: $(macOSXVmPool)
vmImage: $(macOSXVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals x64
artifact: nuget-macos
- name: BuildTemplatePlatforms
type: object
default:
- name: Windows
poolName: $(windowsVmPool)
vmImage: $(windowsVmImage)
demands:
- Agent.OS -equals Windows_NT
artifact: build-windows
- name: macOS
poolName: $(macOSXVmPool)
vmImage: $(macOSXVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals x64
artifact: build-macos
- name: RunTemplatePlatforms
type: object
default:
- name: $(androidTestsVmPool)
vmImage: $(androidTestsVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals x64
testName: RunOnAndroid
artifact: templates-run-android
- name: $(iosTestsVmPool)
vmImage: $(iosTestsVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals x64
testName: RunOniOS
artifact: templates-run-ios
- name: MacTemplatePool
type: object
default:
name: $(androidTestsVmPool)
vmImage: $(androidTestsVmImage)
demands:
- macOS.Name -equals Sonoma
- macOS.Architecture -equals arm64
- name: TestTargetFrameworks
type: object
default:
- name: default
tfm: default
- name: net9
tfm: net9.0
resources:
repositories:
- repository: yaml-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
ref: refs/heads/main
- repository: sdk-insertions
type: github
name: xamarin/sdk-insertions
ref: refs/heads/main
endpoint: xamarin
stages:
- stage: build_net
displayName: Build .NET MAUI
dependsOn: []
jobs:
- ${{ each BuildPlatform in parameters.BuildPlatforms }}:
- ${{ each BuildConfiguration in parameters.BuildConfigurations }}:
- job: build_net_${{ BuildPlatform.name }}_${{ BuildConfiguration }}
workspace:
clean: all
displayName: ${{ BuildPlatform.name }} (${{ BuildConfiguration }})
timeoutInMinutes: 240
condition: or(
${{ parameters.BuildEverything }},
ne(variables['Build.Reason'], 'PullRequest'),
eq('${{ BuildConfiguration }}', 'Release'))
pool:
name: ${{ BuildPlatform.poolName }}
vmImage: ${{ BuildPlatform.vmImage }}
demands: ${{ BuildPlatform.demands }}
steps:
- template: common/provision.yml
parameters:
poolName: ${{ BuildPlatform.poolName }}
skipAndroidSdks: true
skipAndroidImages: true
installDefaultAndroidApi: false
skipXcode: ${{ ne(BuildPlatform.name , 'macOS') }}
${{ if parameters.UseProvisionator }}:
skipProvisioning: false
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
${{ else }}:
skipProvisioning: true
- pwsh: ./build.ps1 --target=dotnet --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Install .NET'
retryCountOnTaskFailure: 3
env:
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
PRIVATE_BUILD: $(PrivateBuild)
- pwsh: ./build.ps1 --target=dotnet-build --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Build .NET Maui'
- pwsh: ./build.ps1 --target=dotnet-test --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Run Unit Tests'
- task: PublishTestResults@2
condition: always()
inputs:
testRunner: VSTest
testResultsFiles: '$(build.artifactstagingdirectory)/**/*.trx'
- task: PublishBuildArtifacts@1
condition: always()
displayName: Publish Artifacts (${{ BuildPlatform.artifact }})
inputs:
ArtifactName: ${{ BuildPlatform.artifact }}
- stage: pack_net
displayName: Pack .NET MAUI
dependsOn: []
jobs:
- ${{ each PackPlatform in parameters.PackPlatforms }}:
- job: pack_net_${{ PackPlatform.name }}
workspace:
clean: all
displayName: ${{ PackPlatform.name }}
timeoutInMinutes: 240
pool:
name: ${{ PackPlatform.poolName }}
vmImage: ${{ PackPlatform.vmImage }}
demands: ${{ PackPlatform.demands }}
variables:
- name: _buildScript
value: $(Build.SourcesDirectory)/build.cmd -ci
- name: _BuildConfig
value: Release
- name: _BuildOfficalId
value: $[ format('{0}.{1}', format('{0:yyyyMMdd}', pipeline.startTime), counter(format('{0:yyyyMMdd}', pipeline.startTime), 1) )]
steps:
- template: common/pack.yml
parameters:
platform: ${{ PackPlatform.name }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
artifact: ${{ PackPlatform.artifact }}
artifactsPath: $(Build.ArtifactStagingDirectory)
artifactBinaries: 'pack-binaries'
buildConfiguration: $(_BuildConfig)
dotnetScript: $(Build.SourcesDirectory)/dotnet.cmd
buildScript: $(_buildScript)
repoArtifactsPath: $(Build.Arcade.ArtifactsPath)
repoLogPath: $(Build.Arcade.LogsPath)
repoTestResultsPath: $(Build.Arcade.TestResultsPath)
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
officialBuildId: $(_BuildOfficalId)
prepareSteps:
- template: common/provision.yml
parameters:
checkoutDirectory: '$(System.DefaultWorkingDirectory)'
provisionatorChannel: ${{ parameters.provisionatorChannel }}
skipAndroidSdks: true
skipAndroidImages: true
installDefaultAndroidApi: true
skipXcode: ${{ ne(PackPlatform.name , 'macOS') }}
${{ if parameters.UseProvisionator }}:
skipProvisioning: false
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
${{ else }}:
skipProvisioning: true
- stage: samples_net
displayName: Test .NET MAUI Samples
dependsOn: pack_net
jobs:
- ${{ each BuildPlatform in parameters.BuildPlatforms }}:
- job: build_net_${{ BuildPlatform.name }}_samples
workspace:
clean: all
displayName: ${{ BuildPlatform.name }}
timeoutInMinutes: 120
pool:
name: ${{ BuildPlatform.poolName }}
vmImage: ${{ BuildPlatform.vmImage }}
demands: ${{ BuildPlatform.demands }}
steps:
- template: common/provision.yml
parameters:
poolName: ${{ BuildPlatform.poolName }}
skipAndroidSdks: true
skipAndroidImages: true
installDefaultAndroidApi: true
skipXcode: ${{ ne(BuildPlatform.name , 'macOS') }}
${{ if parameters.UseProvisionator }}:
skipProvisioning: false
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
${{ else }}:
skipProvisioning: true
- task: DownloadBuildArtifacts@0
displayName: 'Download Packages'
inputs:
artifactName: nuget
itemPattern: '**/*.nupkg'
downloadPath: $(System.DefaultWorkingDirectory)/artifacts
- pwsh: Move-Item -Path artifacts\nuget\*.nupkg -Destination artifacts -Force
displayName: Move the downloaded artifacts
- pwsh: ./build.ps1 --target=dotnet-local-workloads --verbosity=diagnostic
displayName: 'Install .NET (Local Workloads)'
retryCountOnTaskFailure: 3
env:
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
PRIVATE_BUILD: $(PrivateBuild)
- pwsh: ./build.ps1 --target=dotnet-integration-build --verbosity=diagnostic
displayName: Build Microsoft.Maui.IntegrationTests
- pwsh: ./build.ps1 --target=dotnet-integration-test --filter="Category=Samples" --resultsfilename="integration-samples" --verbosity=diagnostic
displayName: Run ${{ BuildPlatform.name }} sample build tests
- task: PublishTestResults@2
displayName: Publish the ${{ BuildPlatform.name }} sample build tests
condition: always()
inputs:
testRunner: VSTest
testResultsFiles: '$(build.artifactstagingdirectory)/**/*.trx'
testRunTitle: ${{ BuildPlatform.name }} sample build tests
- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts
inputs:
ArtifactName: build_net_${{ BuildPlatform.name }}_samples
- stage: templates_net
displayName: Test Templates
dependsOn: pack_net
jobs:
- template: common/maui-templates.yml
parameters:
RunPlatforms: ${{ parameters.RunTemplatePlatforms }}
BuildPlatforms: ${{ parameters.BuildTemplatePlatforms }}
MacBuildPool: ${{ parameters.MacTemplatePool }}
${{ if parameters.UseProvisionator }}:
skipProvisioning: false
${{ else }}:
skipProvisioning: true
conditionMacTemplates: or(
${{ parameters.BuildEverything }},
ne(variables['Build.Reason'], 'PullRequest'),
eq(variables['System.TeamProject'], 'devdiv'))
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- template: common/localization-handoff.yml # Process outgoing strings [Localization Handoff]