maui/eng/pipelines/handlers.yml

269 строки
9.1 KiB
YAML
Исходник Обычный вид История

trigger:
branches:
include:
- main
2021-04-24 20:06:28 +03:00
- release/*
- net7.0
2022-11-28 14:05:58 +03:00
- net8.0
2021-05-05 20:56:05 +03:00
- loc
2021-03-11 19:23:29 +03:00
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
2021-04-24 21:19:50 +03:00
- release/*
- net7.0
2022-11-28 14:05:58 +03:00
- net8.0
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
- template: templates/common/vs-release-vars.yml@sdk-insertions
parameters:
- 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
2021-06-17 14:20:48 +03:00
poolName: $(windowsNet6VmPool)
vmImage: $(windowsNet6VmImage)
bootsAndroid: $(Android.Msi)
bootsiOS: $(iOS.Msi)
artifact: build-windows
- name: macOS
poolName: $(macOSXNet6VmPool)
vmImage: $(macOSXNet6VmImage)
bootsAndroid: $(Android.Pkg)
bootsiOS: $(iOS.Pkg)
bootsMacCatalyst: $(MacCatalyst.Pkg)
artifact: build-macos
- name: PackPlatforms
type: object
default:
- name: Windows
2021-06-17 14:20:48 +03:00
poolName: $(windowsNet6VmPool)
vmImage: $(windowsNet6VmImage)
bootsAndroid: $(Android.Msi)
bootsiOS: $(iOS.Msi)
artifact: nuget
- name: macOS
2021-06-17 14:20:48 +03:00
poolName: $(macOSXNet6VmPool)
vmImage: $(macOSXNet6VmImage)
bootsAndroid: $(Android.Pkg)
bootsiOS: $(iOS.Pkg)
bootsMacCatalyst: $(MacCatalyst.Pkg)
artifact: nuget-macos
- name: TestTargetFrameworks
type: object
default:
- name: default
tfm: default
- name: net6
tfm: net6.0
- name: net7
tfm: net7.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:
2022-11-28 14:05:58 +03:00
- stage: build_net
displayName: Build .NET MAUI
dependsOn: []
jobs:
- ${{ each BuildPlatform in parameters.BuildPlatforms }}:
- ${{ each BuildConfiguration in parameters.BuildConfigurations }}:
2022-11-28 14:05:58 +03:00
- 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 }}
2022-03-28 20:20:40 +03:00
demands:
- macOS.Name -equals Monterey
- macOS.Architecture -equals x64
- Agent.HasDevices -equals False
- Agent.IsPaired -equals False
steps:
- template: common/provision.yml
parameters:
platform: ${{ BuildPlatform.name }}
[ci] Target the Mac internal-macOS-11 hosted agent pool (#4241) * Target the internal-macOS-11 hosted agent pool * Pool name letter casing: internal-macos-11 * Update 'macOS' letter casing in BuildPlatform.name conditions * Fix spacing * Repo reference to yaml-templates * Fix: Template references: yaml-templates -> xamarin-templates * Agent.OSArchitecture is not defined as a capability on agents in the internal-macos-11 pool * Select .NET 6 * UseDotNet task title: Use .NET SDK 6 * Provision needed dependencies on hosted Mac pool Provisioning: Support for 'provisioning' parameter, which is set when macOS is true * Use alternate expansion for parameters.provisioning setting * provision: Always provision additional software on macOS * Dedicated provisioning step & script for mono * Dedicated task & script for provisioning Xamarin.Mac * Provision additional software when running against an on-prem agent pool and not a hosted pool * Fix: Provision Additional Software: Conditional syntax missing closing paren * Provision Additional Software condition: Remove superfluous space * Apply desired set of on-prem pool demands to ensure build is vectored to an x64 Big Sur machine having no devices or pairing * Only apply shared pool demands when running on an agent in the shared pool * agent-cleanser: Only cleanse off mono & Xamarin.Mac when run on a hosted agent. Then provision the versions that the pipeline needs * Fix: agent-cleanser parameters: Terminating colon missing on 'if' conditionals * Fix: Avoid including agent demands when running on a hosted pool * Reset agent Mac pool settings to use macOSXNet6VmPool and macOSXNet6VmImage variables * Simplify demands to apply only to the shared pool * Remove special handling for cleansing & reinstall of mono and Xamarin.Mac. Depend on the versions provided by the agent * TEST: Target hosted pool to ensure pipeline works there * Revert test changes: Target Mac agent pools defined on build def
2022-01-26 13:50:07 +03:00
poolName: ${{ BuildPlatform.poolName }}
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
- pwsh: ./build.ps1 --target=dotnet --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Install .NET'
retryCountOnTaskFailure: 3
[ci] Allow to build agains internal sdks (#4591) (#4624) * [ci] setup internal .NET builds Context: https://github.com/xamarin/xamarin-android-private/commit/5c8a5432fa20e26926caee470ed3391010d33a93 To consume private .NET 6 builds we need two parts: 1. Run `SetupNugetSources.ps1` with credentials to update the `NuGet.config` file to private feeds. 2. Run `dotnet-install.ps1/sh` with `--azure-feed` and `--feed-credential`. To do this we need the variable groups: # SetupNugetSources - group: AzureDevOps-Artifact-Feeds-Pats # dotnet-install - group: DotNet-MSRC-Storage * Fix empty parameter * Bump to .NET SDK 6.0.100-rc.2.21478.25 * Add "tools" to global.json * Setup dotnet-install.ps1/sh * Fixes for $DOTNET_TOKEN * More fixes * Update DotNet.csproj * Try script type variable syntax * Update version * Bump sdk version * Update DotNet.csproj * use dotnetbuilds-internal-container-uri * Fix variable * use dotnetbuilds-internal-container-read-token * Push more changes to $(dotnetbuilds-internal-container-read-token) * test again * Remove AOT * try this * Revert "Remove AOT" This reverts commit 28b9e6aca4e232831cc5bc198fd2b5225aaedbd0. * Update tools.ps1 * Try not use sources * Update global.json * Revert "Update global.json" This reverts commit 1bc350aac6ebd760a14b3799ba133c7c693a4a8d. * Revert "Try not use sources" This reverts commit 3528400cd50da602e2d60cf43198baf5cbd15899. * Skip dotnet6-internal-transport for workload sources * Revert "Revert "Try not use sources"" This reverts commit 704369edf324696a5122f95b15cfbfa7676dd2e8. * Remove souces from Install target * Revert "Remove souces from Install target" This reverts commit 4337163ee98a315bafade7291e8bc9ee307e3f1e. * Try speciy packages path on nuget.config * Don't use full path * Try use --configfile * Revert "Try use --configfile" This reverts commit d4983c021f0166d82a87c9ee27615a00bd4542c9. * Try add source from exec command * Fix when no token exists * Try fix condition to run private build * Fix yaml * Revert not needed change * Copy nuget.config file to other location * Fix Copy task * Fix command * Remove _ReadAllNuGetSources and specify configfile * [ci] Agent-Cleanser: Ensure .NET cleansing is turned on (#4595) * Agent-Cleanser: Ensure .NET cleansing is turned on * Revise Agent-Cleanser comment explaining why CleanseAgentToolsDotNet is being set * [ci] Add agent cleaner to device tests (#4618) * [ci] Add agent cleaner to device tests * Fix yaml * Add cleanup to device steps * [ci] Pass variables to dotnet install on device tests * Fix get pool name Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Peter Collins <pecolli@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Mike Bond <mjbond-msft@outlook.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Peter Collins <pecolli@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Mike Bond <mjbond-msft@outlook.com>
2022-02-11 12:57:09 +03:00
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 }}
2022-11-28 14:05:58 +03:00
- stage: pack_net
displayName: Pack .NET MAUI
Make .NET 6 Packable (#13881) * Add some common nupkg properties to everything * Remove project property refactored into directory build props * Remove properties now in common dir build props * Add net6 version of project * More net6 * Only target netstandard2.0 now net4* is no longer needed as there's no more vs2017 support * Clean up strong naming a bit * Update dependencies * Package all the things for build tasks in the -t:Pack * Add more net6 project versions * Clean up whitespace * Needed moar NET6 * Name fixes * Added meta project for packaging and package script * Remove assembly copyright (now duplicates) * Add resizetizer, add params to package script * Disable strong naming for now We need to re-evaluate how we do this a bit, we should probably use the `al` tool to do it now, and I believe the StrongNamer package may not work anymore, but we can do the same thing in a custom target at a later date. * Fix path to tasks assembly * don't build ios on android specific project * Finish rename of toolbox file * - add cake * - fix cake extras * fix the copy for the IDE * Try packing on CI * versions baby! * build release * this should od it * this * oops * Move to an empty folder * Use new symbol formats * no symbols for build tasks and the head * symbol all the things * Compiler error with commented out code XD * oopsies * only build transitive * Try this * log everything * This might work * REPORTS * previews * needed * versions * duh * Update build.cake Co-authored-by: Shane Neuville <shneuvil@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
2021-03-02 20:36:17 +03:00
dependsOn: []
jobs:
- ${{ each PackPlatform in parameters.PackPlatforms }}:
2022-11-28 14:05:58 +03:00
- job: pack_net_${{ PackPlatform.name }}
workspace:
clean: all
displayName: ${{ PackPlatform.name }}
timeoutInMinutes: 240
pool:
name: ${{ PackPlatform.poolName }}
vmImage: ${{ PackPlatform.vmImage }}
2022-03-28 20:20:40 +03:00
demands:
- macOS.Name -equals Monterey
- macOS.Architecture -equals x64
- Agent.HasDevices -equals False
- Agent.IsPaired -equals False
steps:
- template: common/pack.yml
parameters:
platform: ${{ PackPlatform.name }}
poolName: ${{ PackPlatform.poolName }}
provisionatorChannel: ${{ parameters.provisionatorChannel }}
artifact: ${{ PackPlatform.artifact }}
gitHubToken: $(github--pat--vs-mobiletools-engineering-service2)
2022-11-28 14:05:58 +03:00
- stage: samples_net
displayName: Build .NET MAUI Samples
2022-11-28 14:05:58 +03:00
dependsOn: pack_net
jobs:
- ${{ each BuildPlatform in parameters.BuildPlatforms }}:
- ${{ each BuildConfiguration in parameters.BuildConfigurations }}:
2022-11-28 14:05:58 +03:00
- 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 }}
2022-03-28 20:20:40 +03:00
demands:
- macOS.Name -equals Monterey
- macOS.Architecture -equals x64
- Agent.HasDevices -equals False
- Agent.IsPaired -equals False
steps:
- template: common/provision.yml
parameters:
platform: ${{ BuildPlatform.name }}
[ci] Target the Mac internal-macOS-11 hosted agent pool (#4241) * Target the internal-macOS-11 hosted agent pool * Pool name letter casing: internal-macos-11 * Update 'macOS' letter casing in BuildPlatform.name conditions * Fix spacing * Repo reference to yaml-templates * Fix: Template references: yaml-templates -> xamarin-templates * Agent.OSArchitecture is not defined as a capability on agents in the internal-macos-11 pool * Select .NET 6 * UseDotNet task title: Use .NET SDK 6 * Provision needed dependencies on hosted Mac pool Provisioning: Support for 'provisioning' parameter, which is set when macOS is true * Use alternate expansion for parameters.provisioning setting * provision: Always provision additional software on macOS * Dedicated provisioning step & script for mono * Dedicated task & script for provisioning Xamarin.Mac * Provision additional software when running against an on-prem agent pool and not a hosted pool * Fix: Provision Additional Software: Conditional syntax missing closing paren * Provision Additional Software condition: Remove superfluous space * Apply desired set of on-prem pool demands to ensure build is vectored to an x64 Big Sur machine having no devices or pairing * Only apply shared pool demands when running on an agent in the shared pool * agent-cleanser: Only cleanse off mono & Xamarin.Mac when run on a hosted agent. Then provision the versions that the pipeline needs * Fix: agent-cleanser parameters: Terminating colon missing on 'if' conditionals * Fix: Avoid including agent demands when running on a hosted pool * Reset agent Mac pool settings to use macOSXNet6VmPool and macOSXNet6VmImage variables * Simplify demands to apply only to the shared pool * Remove special handling for cleansing & reinstall of mono and Xamarin.Mac. Depend on the versions provided by the agent * TEST: Target hosted pool to ensure pipeline works there * Revert test changes: Target Mac agent pools defined on build def
2022-01-26 13:50:07 +03:00
poolName: ${{ BuildPlatform.poolName }}
- task: DownloadBuildArtifacts@0
displayName: 'Download Packages'
.NET MAUI is now a "workload" (#603) TDLR: Microsoft.Maui.* NuGet packages are removed in favor of .NET Workloads. See `src/Workloads/README.md` for full details. The idea, is a project to be able to set `$(UseMaui)`: <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0-android</TargetFramework> <OutputType>Exe</OutputType> <UseMaui>true</UseMaui> </PropertyGroup> </Project> `$(UseMaui)` automatically brings in the following workload packs: * `Microsoft.NET.Sdk.Maui` * `Microsoft.Maui.Controls.Sdk` * `Microsoft.Maui.Resizetizer.Sdk` * `Microsoft.Maui.Core.Ref.[platform]` * `Microsoft.Maui.Core.Runtime.[platform]` * `Microsoft.Maui.Controls.Ref.[platform]` * `Microsoft.Maui.Controls.Runtime.[platform]` * `Microsoft.Maui.Dependencies` * `Microsoft.Maui.Essentials.Ref.[platform]` * `Microsoft.Maui.Essentials.Runtime.[platform]` * `Microsoft.Maui.Extensions` * `Microsoft.Maui.Templates` BlazorWebView is an addition to MAUI, project can currently opt into it by adding `.Razor` to the `Sdk` attribute. `<Project Sdk="Microsoft.NET.Sdk.Razor">` sets `$(UsingMicrosoftNETSdkRazor)`, which triggers the MAUI workload to include: * `Microsoft.AspNetCore.Components.WebView.Maui` This will automatically add these dependencies: <PackageReference Include="Microsoft.AspNetCore.Authorization" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebView" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" /> <PackageReference Include="Microsoft.JSInterop" /> If you are a .NET 6 project, but don't want to use Microsoft.Maui.Controls you could bring in partial parts of MAUI. `$(UseMauiAssets)` brings in `Microsoft.Maui.Resizetizer.Sdk`. `$(UseMauiCore)` brings in: * `Microsoft.Maui.Core.Ref.[platform]` * `Microsoft.Maui.Core.Runtime.[platform]` `$(UseMauiEssentials)` brings in: * `Microsoft.Maui.Essentials.Ref.[platform]` * `Microsoft.Maui.Essentials.Runtime.[platform]` Special files: * `AutoImport.props` - defines the default includes (or wildcards) for Maui projects will go. Note that this is imported by *all* .NET 6 project types -- *even non-mobile ones*. * `WorkloadManifest.json` - general .NET workload configuration * `WorkloadManifest.targets` - imports `Microsoft.Maui.Controls.Sdk` when `$(UseMaui)` is `true`. Note that this is imported by *all* .NET 6 project types -- *even non-mobile ones*. For further details about .NET Workloads, see these .NET design docs: * [.NET Optional SDK Workloads](https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workloads.md) * [Workload Resolvers](https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-resolvers.md) * [Workload Manifests](https://github.com/mhutch/designs/blob/b82449a228c0addb95b5a4995bb838749ea6f8cc/accepted/2020/workloads/workload-manifest.md)
2021-06-16 19:59:53 +03:00
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 --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Install .NET (Local Workloads)'
retryCountOnTaskFailure: 3
[ci] Allow to build agains internal sdks (#4591) (#4624) * [ci] setup internal .NET builds Context: https://github.com/xamarin/xamarin-android-private/commit/5c8a5432fa20e26926caee470ed3391010d33a93 To consume private .NET 6 builds we need two parts: 1. Run `SetupNugetSources.ps1` with credentials to update the `NuGet.config` file to private feeds. 2. Run `dotnet-install.ps1/sh` with `--azure-feed` and `--feed-credential`. To do this we need the variable groups: # SetupNugetSources - group: AzureDevOps-Artifact-Feeds-Pats # dotnet-install - group: DotNet-MSRC-Storage * Fix empty parameter * Bump to .NET SDK 6.0.100-rc.2.21478.25 * Add "tools" to global.json * Setup dotnet-install.ps1/sh * Fixes for $DOTNET_TOKEN * More fixes * Update DotNet.csproj * Try script type variable syntax * Update version * Bump sdk version * Update DotNet.csproj * use dotnetbuilds-internal-container-uri * Fix variable * use dotnetbuilds-internal-container-read-token * Push more changes to $(dotnetbuilds-internal-container-read-token) * test again * Remove AOT * try this * Revert "Remove AOT" This reverts commit 28b9e6aca4e232831cc5bc198fd2b5225aaedbd0. * Update tools.ps1 * Try not use sources * Update global.json * Revert "Update global.json" This reverts commit 1bc350aac6ebd760a14b3799ba133c7c693a4a8d. * Revert "Try not use sources" This reverts commit 3528400cd50da602e2d60cf43198baf5cbd15899. * Skip dotnet6-internal-transport for workload sources * Revert "Revert "Try not use sources"" This reverts commit 704369edf324696a5122f95b15cfbfa7676dd2e8. * Remove souces from Install target * Revert "Remove souces from Install target" This reverts commit 4337163ee98a315bafade7291e8bc9ee307e3f1e. * Try speciy packages path on nuget.config * Don't use full path * Try use --configfile * Revert "Try use --configfile" This reverts commit d4983c021f0166d82a87c9ee27615a00bd4542c9. * Try add source from exec command * Fix when no token exists * Try fix condition to run private build * Fix yaml * Revert not needed change * Copy nuget.config file to other location * Fix Copy task * Fix command * Remove _ReadAllNuGetSources and specify configfile * [ci] Agent-Cleanser: Ensure .NET cleansing is turned on (#4595) * Agent-Cleanser: Ensure .NET cleansing is turned on * Revise Agent-Cleanser comment explaining why CleanseAgentToolsDotNet is being set * [ci] Add agent cleaner to device tests (#4618) * [ci] Add agent cleaner to device tests * Fix yaml * Add cleanup to device steps * [ci] Pass variables to dotnet install on device tests * Fix get pool name Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Peter Collins <pecolli@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Mike Bond <mjbond-msft@outlook.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: Peter Collins <pecolli@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Mike Bond <mjbond-msft@outlook.com>
2022-02-11 12:57:09 +03:00
env:
DOTNET_TOKEN: $(dotnetbuilds-internal-container-read-token)
PRIVATE_BUILD: $(PrivateBuild)
- pwsh: ./build.ps1 --target=dotnet-samples --configuration="${{ BuildConfiguration }}" --verbosity=diagnostic
displayName: 'Build .NET MAUI Samples'
2021-08-26 01:51:03 +03:00
- task: PublishBuildArtifacts@1
condition: always()
displayName: publish artifacts
inputs:
ArtifactName: ${{ BuildPlatform.artifact }}
2022-11-28 14:05:58 +03:00
- stage: templates_net
displayName: Test Templates
2022-11-28 14:05:58 +03:00
dependsOn: pack_net
2021-08-26 01:51:03 +03:00
jobs:
- template: common/maui-templates.yml
2021-03-04 22:41:31 +03:00
- template: common/security-compliance.yml
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- template: common/localization-handoff.yml # Process outgoing strings [Localization Handoff]
- template: common/localization-handback.yml # Process incoming translations and Create PR to main [Localization Handback]
- template: common/merge-translations-update.yml # Validating incoming translations strings and merge PR [Localization Handback]