maui/eng/pipelines/handlers.yml

358 строки
13 KiB
YAML

trigger:
branches:
include:
- main
- release/*
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
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- main
variables:
- template: /eng/pipelines/common/variables.yml
parameters:
- name: BuildEverything
type: boolean
default: false
- name: BuildConfigurations
type: object
default:
- Debug
- Release
- name: BuildPlatforms
type: object
default:
- name: windows
poolName: 'Azure Pipelines'
vmImage: windows-latest
bootsAndroid: $(Android.Msi)
bootsiOS: $(iOS.Msi)
artifact: net6-windows
- name: macos
poolName: $(macOSXNet6VmPool)
vmImage: $(macOSXNet6VmImage)
bootsAndroid: $(Android.Pkg)
bootsiOS: $(iOS.Pkg)
bootsMacCatalyst: $(MacCatalyst.Pkg)
artifact: net6-macos
- name: PackPlatforms
type: object
default:
- name: windows
poolName: 'Azure Pipelines'
vmImage: windows-latest
bootsAndroid: $(Android.Msi)
bootsiOS: $(iOS.Msi)
artifact: nuget
- name: macos
poolName: 'Azure Pipelines'
vmImage: macos-latest
bootsAndroid: $(Android.Pkg)
bootsiOS: $(iOS.Pkg)
bootsMacCatalyst: $(MacCatalyst.Pkg)
artifact: nuget-macos
resources:
repositories:
- repository: xamarin-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
ref: refs/heads/main # still defaults to master even though main is the main branch
stages:
- stage: windows
displayName: Build Windows
jobs:
- ${{ each BuildCondition in parameters.BuildConfigurations }}:
- job: win_hosted_${{ BuildCondition }}
workspace:
clean: all
displayName: Build Windows Phase (${{ BuildCondition }})
condition: or(
${{ parameters.BuildEverything }},
ne(variables['Build.Reason'], 'PullRequest'),
eq('${{ BuildCondition }}', 'Release'))
timeoutInMinutes: 60
pool:
name: $(vs2019VmPool)
vmImage: $(vs2019VmImage)
demands: [ msbuild ]
steps:
- template: common/build-windows.yml
# - stage: windows_controlgallery
# displayName: Build Windows ControlGallery
# dependsOn: []
# jobs:
# - ${{ each BuildCondition in parameters.BuildConfigurations }}:
# - job: win_hosted_${{ BuildCondition }}
# workspace:
# clean: all
# displayName: Build Windows Phase (${{ BuildCondition }})
# condition: or(
# ${{ parameters.BuildEverything }},
# ne(variables['Build.Reason'], 'PullRequest'),
# eq('${{ BuildCondition }}', 'Release'))
# timeoutInMinutes: 60
# pool:
# name: $(vs2019VmPool)
# vmImage: $(vs2019VmImage)
# demands: [ msbuild ]
# steps:
# - template: common/controlgallery-windows.yml
- stage: build_osx
displayName: iOS
dependsOn: []
jobs:
- job: ios
workspace:
clean: all
displayName: Build ControlGallery iOS
timeoutInMinutes: 120
pool:
name: $(macOSXVmPool)
vmImage: $(macOSXVmImage)
demands:
- sh
- Xamarin.iOS
steps:
- template: common/controlgallery-ios.yml
- stage: build_android
displayName: Android
dependsOn: []
jobs:
- job: android
workspace:
clean: all
displayName: Build ControlGallery Android
timeoutInMinutes: 120
pool:
name: $(macOSXVmPool)
vmImage: $(macOSXVmImage)
variables:
renderers: 'FAST'
outputfolder: 'newRenderers'
steps:
- template: common/controlgallery-android.yml
- stage: pack_net6
displayName: Pack .NET 6
dependsOn: []
jobs:
- ${{ each BuildPlatform in parameters.PackPlatforms }}:
- job: pack_net6_${{ BuildPlatform.name }}
workspace:
clean: all
displayName: Pack .NET 6 (${{ BuildPlatform.name }})
timeoutInMinutes: 120
pool:
name: ${{ BuildPlatform.poolName }}
vmImage: ${{ BuildPlatform.vmImage }}
steps:
- ${{ if eq(BuildPlatform.name, 'macos') }}:
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision Xcode'
condition: ne(variables['REQUIRED_XCODE'], '')
inputs:
provisioning_script: $(provisionator.xcode)
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: $(provisionator.xcode)
provisioning_extra_args: $(provisionator.extraArguments)
- script: |
echo "##vso[task.prependpath]/Library/Frameworks/Mono.framework/Versions/Current/Commands/"
echo "##vso[task.prependpath]~/Library/Developer/Xamarin/android-sdk-macosx"
displayName: 'Setup SDK Paths'
condition: ne(variables['osx2019VmPool'], 'Azure Pipelines')
- bash: |
set -x
mkdir -p ~/Library/Preferences/Xamarin
rm -f ~/Library/Preferences/Xamarin/Settings.plist
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string $(dirname $(dirname $(xcode-select -p)))" ~/Library/Preferences/Xamarin/Settings.plist || true
cat ~/Library/Preferences/Xamarin/Settings.plist || true
displayName: configure vsmac xcode
- script: echo '##vso[task.setvariable variable=JI_JAVA_HOME]$(JAVA_HOME_11_X64)'
displayName: set JI_JAVA_HOME
- ${{ if eq(BuildPlatform.name, 'windows') }}:
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision VSWindows'
inputs:
provisioning_script: $(provisionator.vs2019)
- script: dotnet tool restore
displayName: install dotnet tools
- script: dotnet cake --configuration=Release
displayName: pack nugets
- task: CopyFiles@2
displayName: 'Copy SignList.xml Files'
inputs:
Contents: |
**/Microsoft.Maui.*.nupkg
**/Microsoft.Maui.*.snupkg
**/Microsoft.AspNetCore.Components.WebView.Maui.*.nupkg
**/Microsoft.AspNetCore.Components.WebView.Maui.*.snupkg
**/SignList.xml
TargetFolder: $(build.artifactstagingdirectory)
flattenFolders: true
- task: CopyFiles@2
displayName: 'Copy Bin Log Files'
condition: always()
inputs:
Contents: |
**/*.binlog
TargetFolder: $(build.artifactstagingdirectory)
flattenFolders: true
- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts
inputs:
ArtifactName: ${{ BuildPlatform.artifact }}
- stage: build_net6
displayName: Build .NET 6
dependsOn: []
jobs:
- ${{ each BuildPlatform in parameters.BuildPlatforms }}:
- ${{ each BuildCondition in parameters.BuildConfigurations }}:
- job: build_net6_${{ BuildPlatform.name }}_${{ BuildCondition }}
workspace:
clean: all
displayName: Build .NET 6 (${{ BuildPlatform.name }} | ${{ BuildCondition }})
timeoutInMinutes: 120
condition: or(
${{ parameters.BuildEverything }},
ne(variables['Build.Reason'], 'PullRequest'),
eq('${{ BuildCondition }}', 'Release'))
pool:
name: ${{ BuildPlatform.poolName }}
vmImage: ${{ BuildPlatform.vmImage }}
steps:
- ${{ if eq(BuildPlatform.name, 'macos') }}:
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision Xcode'
condition: ne(variables['REQUIRED_XCODE'], '')
inputs:
provisioning_script: $(provisionator.xcode)
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provisionator'
condition: eq(variables['provisioning'], 'true')
inputs:
provisioning_script: $(provisionator.xcode)
provisioning_extra_args: $(provisionator.extraArguments)
- script: |
echo "##vso[task.prependpath]/Library/Frameworks/Mono.framework/Versions/Current/Commands/"
echo "##vso[task.prependpath]~/Library/Developer/Xamarin/android-sdk-macosx"
displayName: 'Setup SDK Paths'
condition: ne(variables['osx2019VmPool'], 'Azure Pipelines')
- bash: |
set -x
mkdir -p ~/Library/Preferences/Xamarin
rm -f ~/Library/Preferences/Xamarin/Settings.plist
/usr/libexec/PlistBuddy -c "add :AppleSdkRoot string $(dirname $(dirname $(xcode-select -p)))" ~/Library/Preferences/Xamarin/Settings.plist || true
cat ~/Library/Preferences/Xamarin/Settings.plist || true
displayName: configure vsmac xcode
- script: echo '##vso[task.setvariable variable=JI_JAVA_HOME]$(JAVA_HOME_11_X64)'
displayName: set JI_JAVA_HOME
- ${{ if eq(BuildPlatform.name, 'windows') }}:
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: 'Provision VSWindows'
inputs:
provisioning_script: $(provisionator.vs2019)
- pwsh: |
& dotnet build src/DotNet/DotNet.csproj -bl:$(LogDirectory)/$(BuildConfiguration)-dotnet.binlog
& $(DotNet.Path) build Microsoft.Maui.BuildTasks-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration)-buildtasks.binlog
& $(DotNet.Path) build Microsoft.Maui-net6.sln -c $(BuildConfiguration) -bl:$(LogDirectory)/$(BuildConfiguration).binlog
displayName: build samples
errorActionPreference: stop
- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts
inputs:
ArtifactName: ${{ BuildPlatform.artifact }}
- template: common/device-tests.yml
parameters:
${{ if or(parameters.BuildEverything, ne(variables['Build.Reason'], 'PullRequest')) }}:
androidApiLevels: [ 30, 29, 21 ]
iosVersions: [ 'latest' ]
projects:
- name: essentials
desc: Essentials
android: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests.Android/Essentials.DeviceTests.Android.csproj
ios: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests.iOS/Essentials.DeviceTests.iOS.csproj
- name: core
desc: Core
android: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests.Android/Core.DeviceTests.Android.csproj
ios: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests.iOS/Core.DeviceTests.iOS.csproj
# only sign using the private server
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- stage: nuget_signing
dependsOn: pack_net6
displayName: Sign Nuget
jobs:
- template: sign-artifacts/jobs/v2.yml@xamarin-templates
parameters:
teamName: Maui
usePipelineArtifactTasks: false
targetFolder: $(Build.ArtifactStagingDirectory)/nuget/signed
signedArtifactName: nuget
signedArtifactPath: signed
displayName: Sign Phase
condition: and(succeeded(), ne(variables['signVmImage'], ''), 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/') ))))