|
| 1 | +# .NET for Android Pipeline - Public Build |
| 2 | +# This pipeline runs on the public dnceng instance for: |
| 3 | +# - PRs from forks (contributors) |
| 4 | +# - Main or release branch CI builds |
| 5 | +# Internal branches use the DevDiv pipeline (azure-pipelines.yaml) |
| 6 | + |
| 7 | +name: $(Build.SourceBranchName)-$(Build.SourceVersion)-$(Rev:r) |
| 8 | + |
| 9 | +trigger: |
| 10 | + branches: |
| 11 | + include: |
| 12 | + - main |
| 13 | + - release/* |
| 14 | + |
| 15 | +pr: |
| 16 | + branches: |
| 17 | + include: |
| 18 | + - main |
| 19 | + - release/* |
| 20 | + |
| 21 | +parameters: |
| 22 | +- name: macTestAgentsUseCleanImages # Test agents we do not need to clean up when finished because they are not reused |
| 23 | + default: true |
| 24 | +- name: skipTests # Skip all test stages (builds only). Use 'auto' to auto-skip for non-fork PRs. |
| 25 | + displayName: Skip Tests |
| 26 | + type: string |
| 27 | + default: 'auto' |
| 28 | + values: |
| 29 | + - 'auto' |
| 30 | + - 'true' |
| 31 | + - 'false' |
| 32 | + |
| 33 | +# Repository resources - checkout android-tools to force multi-repo checkout behavior |
| 34 | +resources: |
| 35 | + repositories: |
| 36 | + - repository: android-tools |
| 37 | + type: github |
| 38 | + name: dotnet/android-tools |
| 39 | + endpoint: public |
| 40 | + ref: refs/heads/main |
| 41 | + |
| 42 | +# Global variables |
| 43 | +variables: |
| 44 | +- template: /build-tools/automation/yaml-templates/variables.yaml@self |
| 45 | +# Override for public pipeline |
| 46 | +- name: DefaultJavaSdkMajorVersion |
| 47 | + value: 21 |
| 48 | +# Override pool images for public Microsoft-hosted agents |
| 49 | +- name: HostedMacImage |
| 50 | + value: macOS-14 |
| 51 | +- name: LinuxPoolImage |
| 52 | + value: ubuntu-22.04 |
| 53 | +- name: NetCorePublicPoolName |
| 54 | + value: NetCore-Public |
| 55 | +- name: WindowsPoolImageNetCorePublic |
| 56 | + value: windows.vs2022.amd64.open |
| 57 | +- name: LinuxPoolImageNetCorePublic |
| 58 | + value: build.Ubuntu.2204.amd64.open |
| 59 | +# Skip tests for non-fork PRs (they should use DevDiv pipeline) unless explicitly requested |
| 60 | +- name: SkipTestStages |
| 61 | + ${{ if eq(parameters.skipTests, 'true') }}: |
| 62 | + value: true |
| 63 | + ${{ elseif eq(parameters.skipTests, 'false') }}: |
| 64 | + value: false |
| 65 | + ${{ elseif and(eq(variables['Build.Reason'], 'PullRequest'), ne(variables['System.PullRequest.IsFork'], 'True')) }}: |
| 66 | + value: true |
| 67 | + ${{ else }}: |
| 68 | + value: false |
| 69 | + |
| 70 | +# Public builds don't use 1ES templates - just plain stages |
| 71 | +stages: |
| 72 | +# macOS Build Stage |
| 73 | +- stage: mac_build |
| 74 | + displayName: Mac |
| 75 | + jobs: |
| 76 | + - job: mac_build_create_installers |
| 77 | + displayName: macOS > Build |
| 78 | + pool: |
| 79 | + name: Azure Pipelines |
| 80 | + vmImage: $(HostedMacImage) |
| 81 | + os: macOS |
| 82 | + timeoutInMinutes: 240 |
| 83 | + cancelTimeoutInMinutes: 5 |
| 84 | + workspace: |
| 85 | + clean: all |
| 86 | + steps: |
| 87 | + - checkout: self |
| 88 | + path: s/android |
| 89 | + persistCredentials: false |
| 90 | + |
| 91 | + # Checkout a second repo to force multi-repo checkout behavior |
| 92 | + # https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#checkout-path |
| 93 | + - checkout: android-tools |
| 94 | + path: s/android-tools |
| 95 | + |
| 96 | + - template: /build-tools/automation/yaml-templates/build-macos-steps.yaml |
| 97 | + parameters: |
| 98 | + xaSourcePath: $(System.DefaultWorkingDirectory)/android |
| 99 | + installerArtifactName: $(InstallerArtifactName) |
| 100 | + nugetArtifactName: $(NuGetArtifactName) |
| 101 | + testAssembliesArtifactName: $(TestAssembliesArtifactName) |
| 102 | + windowsToolchainPdbArtifactName: $(WindowsToolchainPdbArtifactName) |
| 103 | + buildResultArtifactName: Build Results - macOS |
| 104 | + use1ESTemplate: false |
| 105 | + |
| 106 | +# Windows Build Stage |
| 107 | +- stage: win_build_test |
| 108 | + displayName: Windows |
| 109 | + dependsOn: [] |
| 110 | + jobs: |
| 111 | + - job: win_build_test |
| 112 | + displayName: Windows > Build & Smoke Test |
| 113 | + pool: |
| 114 | + name: $(NetCorePublicPoolName) |
| 115 | + demands: |
| 116 | + - ImageOverride -equals $(WindowsPoolImageNetCorePublic) |
| 117 | + timeoutInMinutes: 240 |
| 118 | + steps: |
| 119 | + - checkout: self |
| 120 | + persistCredentials: false |
| 121 | + |
| 122 | + - template: /build-tools/automation/yaml-templates/build-windows-steps.yaml |
| 123 | + parameters: |
| 124 | + buildResultArtifactName: Build Results - Windows |
| 125 | + use1ESTemplate: false |
| 126 | + |
| 127 | +# Linux Build Stage |
| 128 | +- stage: linux_build |
| 129 | + displayName: Linux |
| 130 | + dependsOn: [] |
| 131 | + jobs: |
| 132 | + - job: linux_build_create_sdk_pack |
| 133 | + displayName: Linux > Build |
| 134 | + pool: |
| 135 | + name: $(NetCorePublicPoolName) |
| 136 | + demands: |
| 137 | + - ImageOverride -equals $(LinuxPoolImageNetCorePublic) |
| 138 | + timeoutInMinutes: 240 |
| 139 | + workspace: |
| 140 | + clean: all |
| 141 | + variables: |
| 142 | + CXX: g++-10 |
| 143 | + CC: gcc-10 |
| 144 | + steps: |
| 145 | + - checkout: self |
| 146 | + path: s/android |
| 147 | + persistCredentials: false |
| 148 | + |
| 149 | + # Checkout a second repo to force multi-repo checkout behavior |
| 150 | + - checkout: android-tools |
| 151 | + path: s/android-tools |
| 152 | + |
| 153 | + - script: | |
| 154 | + sudo apt-get update |
| 155 | + sudo apt-get install -y g++-10 gcc-10 |
| 156 | + displayName: install g++-10 and gcc-10 |
| 157 | +
|
| 158 | + - template: /build-tools/automation/yaml-templates/build-linux-steps.yaml |
| 159 | + parameters: |
| 160 | + buildResultArtifactName: Build Results - Linux |
| 161 | + xaSourcePath: $(System.DefaultWorkingDirectory)/android |
| 162 | + nugetArtifactName: $(LinuxNuGetArtifactName) |
| 163 | + use1ESTemplate: false |
| 164 | + |
| 165 | +# Package Tests Stage |
| 166 | +- ${{ if ne(variables.SkipTestStages, 'true') }}: |
| 167 | + - template: /build-tools/automation/yaml-templates/stage-package-tests.yaml |
| 168 | + parameters: |
| 169 | + macTestAgentsUseCleanImages: ${{ parameters.macTestAgentsUseCleanImages }} |
| 170 | + use1ESTemplate: false |
| 171 | + |
| 172 | +# Linux Tests Stage |
| 173 | +- stage: linux_tests |
| 174 | + displayName: Linux Tests |
| 175 | + dependsOn: |
| 176 | + - mac_build |
| 177 | + - linux_build |
| 178 | + condition: and(succeeded(), ne(variables['SkipTestStages'], 'true')) |
| 179 | + jobs: |
| 180 | + - job: linux_tests_smoke_1 |
| 181 | + displayName: Linux > Tests > MSBuild 1 |
| 182 | + pool: |
| 183 | + name: $(NetCorePublicPoolName) |
| 184 | + demands: |
| 185 | + - ImageOverride -equals $(LinuxPoolImageNetCorePublic) |
| 186 | + timeoutInMinutes: 180 |
| 187 | + workspace: |
| 188 | + clean: all |
| 189 | + steps: |
| 190 | + - template: /build-tools/automation/yaml-templates/setup-test-environment-public.yaml |
| 191 | + parameters: |
| 192 | + useAgentJdkPath: false |
| 193 | + use1ESTemplate: false |
| 194 | + |
| 195 | + - task: DownloadPipelineArtifact@2 |
| 196 | + inputs: |
| 197 | + artifactName: $(TestAssembliesArtifactName) |
| 198 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 199 | + |
| 200 | + - template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml |
| 201 | + parameters: |
| 202 | + testRunTitle: Xamarin.Android.Build.Tests - Linux BuildTest |
| 203 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 204 | + dotNetTestExtraArgs: --filter "Name = BuildTest" |
| 205 | + |
| 206 | + - template: /build-tools/automation/yaml-templates/upload-results.yaml |
| 207 | + parameters: |
| 208 | + configuration: $(XA.Build.Configuration) |
| 209 | + artifactName: Test Results - MSBuild - Linux 1 |
| 210 | + use1ESTemplate: false |
| 211 | + |
| 212 | + - template: /build-tools/automation/yaml-templates/fail-on-issue.yaml |
| 213 | + |
| 214 | + - job: linux_tests_smoke_2 |
| 215 | + displayName: Linux > Tests > MSBuild 2 |
| 216 | + pool: |
| 217 | + name: $(NetCorePublicPoolName) |
| 218 | + demands: |
| 219 | + - ImageOverride -equals $(LinuxPoolImageNetCorePublic) |
| 220 | + timeoutInMinutes: 180 |
| 221 | + workspace: |
| 222 | + clean: all |
| 223 | + steps: |
| 224 | + - template: /build-tools/automation/yaml-templates/setup-test-environment-public.yaml |
| 225 | + parameters: |
| 226 | + useAgentJdkPath: false |
| 227 | + use1ESTemplate: false |
| 228 | + |
| 229 | + - task: DownloadPipelineArtifact@2 |
| 230 | + inputs: |
| 231 | + artifactName: $(TestAssembliesArtifactName) |
| 232 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 233 | + |
| 234 | + - template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml |
| 235 | + parameters: |
| 236 | + testRunTitle: Xamarin.Android.Build.Tests - Linux PackagingTest |
| 237 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 238 | + dotNetTestExtraArgs: --filter "Name = PackagingTest" |
| 239 | + |
| 240 | + - template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml |
| 241 | + parameters: |
| 242 | + testRunTitle: Xamarin.Android.Build.Tests - Linux XASdkTests |
| 243 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 244 | + dotNetTestExtraArgs: --filter "Name = XASdkTests & Name != XamarinLegacySdk" |
| 245 | + |
| 246 | + - template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml |
| 247 | + parameters: |
| 248 | + testRunTitle: Xamarin.Android.Build.Tests - Linux AndroidDependenciesTests |
| 249 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 250 | + dotNetTestExtraArgs: --filter "Name = AndroidDependenciesTests" |
| 251 | + |
| 252 | + - task: ShellScript@2 |
| 253 | + displayName: Test dotnet-local.sh |
| 254 | + inputs: |
| 255 | + scriptPath: dotnet-local.sh |
| 256 | + args: >- |
| 257 | + build samples/HelloWorld/HelloWorld/HelloWorld.DotNet.csproj |
| 258 | + -p:AndroidSdkDirectory="$(HOME)/android-toolchain/sdk" |
| 259 | + -bl:$(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/build-helloworld.binlog |
| 260 | +
|
| 261 | + - template: /build-tools/automation/yaml-templates/upload-results.yaml |
| 262 | + parameters: |
| 263 | + configuration: $(XA.Build.Configuration) |
| 264 | + artifactName: Test Results - MSBuild - Linux 2 |
| 265 | + includeBuildResults: true |
| 266 | + use1ESTemplate: false |
| 267 | + |
| 268 | + - template: /build-tools/automation/yaml-templates/fail-on-issue.yaml |
| 269 | + |
| 270 | +# MSBuild Tests Stage |
| 271 | +- stage: msbuild_dotnet |
| 272 | + displayName: MSBuild Tests |
| 273 | + dependsOn: mac_build |
| 274 | + condition: and(succeeded(), ne(variables['SkipTestStages'], 'true')) |
| 275 | + jobs: |
| 276 | + - job: mac_msbuild_tests |
| 277 | + strategy: |
| 278 | + parallel: 10 |
| 279 | + displayName: macOS > Tests > MSBuild |
| 280 | + pool: |
| 281 | + name: Azure Pipelines |
| 282 | + vmImage: $(HostedMacImage) |
| 283 | + os: macOS |
| 284 | + timeoutInMinutes: 240 |
| 285 | + cancelTimeoutInMinutes: 5 |
| 286 | + steps: |
| 287 | + - template: /build-tools/automation/yaml-templates/setup-test-environment-public.yaml |
| 288 | + parameters: |
| 289 | + installTestSlicer: true |
| 290 | + use1ESTemplate: false |
| 291 | + |
| 292 | + - task: DownloadPipelineArtifact@2 |
| 293 | + inputs: |
| 294 | + artifactName: $(TestAssembliesArtifactName) |
| 295 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 296 | + |
| 297 | + - template: /build-tools/automation/yaml-templates/run-sliced-nunit-tests.yaml |
| 298 | + parameters: |
| 299 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 300 | + testFilter: '' |
| 301 | + testRunTitle: Xamarin.Android.Build.Tests - macOS |
| 302 | + retryFailedTests: false |
| 303 | + xaSourcePath: $(System.DefaultWorkingDirectory) |
| 304 | + |
| 305 | + - template: /build-tools/automation/yaml-templates/upload-results.yaml |
| 306 | + parameters: |
| 307 | + artifactName: Test Results - MSBuild - macOS-$(System.JobPositionInPhase) |
| 308 | + xaSourcePath: $(System.DefaultWorkingDirectory) |
| 309 | + use1ESTemplate: false |
| 310 | + |
| 311 | + - template: /build-tools/automation/yaml-templates/fail-on-issue.yaml |
| 312 | + parameters: |
| 313 | + condition: true |
| 314 | + |
| 315 | + - job: win_msbuild_tests |
| 316 | + strategy: |
| 317 | + parallel: 8 |
| 318 | + displayName: Windows > Tests > MSBuild |
| 319 | + pool: |
| 320 | + name: $(NetCorePublicPoolName) |
| 321 | + demands: |
| 322 | + - ImageOverride -equals $(WindowsPoolImageNetCorePublic) |
| 323 | + timeoutInMinutes: 240 |
| 324 | + cancelTimeoutInMinutes: 5 |
| 325 | + steps: |
| 326 | + - script: netsh int ipv4 set global sourceroutingbehavior=drop |
| 327 | + |
| 328 | + - template: /build-tools/automation/yaml-templates/kill-processes.yaml |
| 329 | + |
| 330 | + - template: /build-tools/automation/yaml-templates/clean.yaml |
| 331 | + |
| 332 | + - template: /build-tools/automation/yaml-templates/setup-test-environment-public.yaml |
| 333 | + parameters: |
| 334 | + useAgentJdkPath: false |
| 335 | + installTestSlicer: true |
| 336 | + use1ESTemplate: false |
| 337 | + |
| 338 | + - task: DownloadPipelineArtifact@2 |
| 339 | + inputs: |
| 340 | + artifactName: $(TestAssembliesArtifactName) |
| 341 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 342 | + |
| 343 | + - template: /build-tools/automation/yaml-templates/run-sliced-nunit-tests.yaml |
| 344 | + parameters: |
| 345 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll |
| 346 | + testFilter: '' |
| 347 | + testRunTitle: Xamarin.Android.Build.Tests - Windows |
| 348 | + retryFailedTests: false |
| 349 | + xaSourcePath: $(System.DefaultWorkingDirectory) |
| 350 | + |
| 351 | + - template: /build-tools/automation/yaml-templates/upload-results.yaml |
| 352 | + parameters: |
| 353 | + artifactName: Test Results - MSBuild - Windows-$(System.JobPositionInPhase) |
| 354 | + xaSourcePath: $(System.DefaultWorkingDirectory) |
| 355 | + use1ESTemplate: false |
| 356 | + |
| 357 | + - template: /build-tools/automation/yaml-templates/fail-on-issue.yaml |
| 358 | + parameters: |
| 359 | + condition: true |
0 commit comments