|
| 1 | +# Runs MSBuild tests that do not require devices on Mac/Windows |
| 2 | + |
| 3 | +parameters: |
| 4 | + mac_agent_count: 8 |
| 5 | + win_agent_count: 4 |
| 6 | + nunit_categories: $(DotNetNUnitCategories) |
| 7 | + target_framework: $(DotNetStableTargetFramework) |
| 8 | + provisionatorChannel: latest |
| 9 | + stageCondition: succeeded() |
| 10 | + |
| 11 | +stages: |
| 12 | +- stage: msbuild_dotnet |
| 13 | + displayName: MSBuild Tests |
| 14 | + dependsOn: mac_build |
| 15 | + condition: ${{ parameters.stageCondition }} |
| 16 | + jobs: |
| 17 | + - job: mac_msbuild_tests |
| 18 | + strategy: |
| 19 | + parallel: ${{ parameters.mac_agent_count }} |
| 20 | + displayName: "macOS > Tests > MSBuild" |
| 21 | + pool: |
| 22 | + vmImage: $(HostedMacImage) |
| 23 | + timeoutInMinutes: 180 |
| 24 | + cancelTimeoutInMinutes: 5 |
| 25 | + workspace: |
| 26 | + clean: all |
| 27 | + variables: |
| 28 | + androidSdkPlatforms: 33 |
| 29 | + steps: |
| 30 | + - template: setup-test-environment.yaml |
| 31 | + parameters: |
| 32 | + provisionClassic: false |
| 33 | + provisionatorChannel: ${{ parameters.provisionatorChannel }} |
| 34 | + installTestSlicer: true |
| 35 | + |
| 36 | + - task: DownloadPipelineArtifact@2 |
| 37 | + inputs: |
| 38 | + artifactName: $(TestAssembliesArtifactName) |
| 39 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 40 | + |
| 41 | + - pwsh: | |
| 42 | + dotnet-test-slicer ` |
| 43 | + --test-assembly="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll" ` |
| 44 | + --test-filter="cat != SmokeTests ${{ parameters.nunit_categories }}" ` |
| 45 | + --slice-number=$(System.JobPositionInPhase) ` |
| 46 | + --total-slices=$(System.TotalJobsInPhase) ` |
| 47 | + --outfile="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.runsettings" |
| 48 | + displayName: Slice unit tests |
| 49 | +
|
| 50 | + - template: run-nunit-tests.yaml |
| 51 | + parameters: |
| 52 | + useDotNet: true |
| 53 | + testRunTitle: Xamarin.Android.Build.Tests - macOS-$(System.JobPositionInPhase) |
| 54 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll |
| 55 | + dotNetTestExtraArgs: --settings "$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.runsettings" |
| 56 | + testResultsFile: TestResult-MSBuildTests-mac_msbuild_tests-$(System.JobPositionInPhase)-$(XA.Build.Configuration).xml |
| 57 | + |
| 58 | + - template: upload-results.yaml |
| 59 | + parameters: |
| 60 | + artifactName: Test Results - MSBuild - macOS-$(System.JobPositionInPhase) |
| 61 | + |
| 62 | + - template: fail-on-issue.yaml |
| 63 | + |
| 64 | + - job: win_msbuild_tests |
| 65 | + strategy: |
| 66 | + parallel: ${{ parameters.win_agent_count }} |
| 67 | + displayName: "Windows > Tests > MSBuild" |
| 68 | + pool: $(1ESWindowsPool) |
| 69 | + timeoutInMinutes: 180 |
| 70 | + cancelTimeoutInMinutes: 5 |
| 71 | + variables: |
| 72 | + androidSdkPlatforms: 33 |
| 73 | + VSINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise |
| 74 | + steps: |
| 75 | + - script: netsh int ipv4 set global sourceroutingbehavior=drop |
| 76 | + |
| 77 | + - template: kill-processes.yaml |
| 78 | + |
| 79 | + - template: clean.yaml |
| 80 | + |
| 81 | + - template: setup-test-environment.yaml |
| 82 | + parameters: |
| 83 | + provisionClassic: false |
| 84 | + provisionatorChannel: ${{ parameters.provisionatorChannel }} |
| 85 | + installTestSlicer: true |
| 86 | + remove_dotnet: true |
| 87 | + |
| 88 | + - task: DownloadPipelineArtifact@2 |
| 89 | + inputs: |
| 90 | + artifactName: $(TestAssembliesArtifactName) |
| 91 | + downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration) |
| 92 | + |
| 93 | + - pwsh: | |
| 94 | + dotnet-test-slicer ` |
| 95 | + --test-assembly="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll" ` |
| 96 | + --test-filter="cat != SmokeTests ${{ parameters.nunit_categories }}" ` |
| 97 | + --slice-number=$(System.JobPositionInPhase) ` |
| 98 | + --total-slices=$(System.TotalJobsInPhase) ` |
| 99 | + --outfile="$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.runsettings" |
| 100 | + displayName: Slice unit tests |
| 101 | +
|
| 102 | + - template: run-nunit-tests.yaml |
| 103 | + parameters: |
| 104 | + useDotNet: true |
| 105 | + testRunTitle: Xamarin.Android.Build.Tests - macOS-$(System.JobPositionInPhase) |
| 106 | + testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll |
| 107 | + dotNetTestExtraArgs: --settings "$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.runsettings" |
| 108 | + testResultsFile: TestResult-MSBuildTests-win_msbuild_tests-$(System.JobPositionInPhase)-$(XA.Build.Configuration).xml |
| 109 | + |
| 110 | + - template: upload-results.yaml |
| 111 | + parameters: |
| 112 | + artifactName: Test Results - MSBuild - Windows-$(System.JobPositionInPhase) |
| 113 | + |
| 114 | + - template: fail-on-issue.yaml |
0 commit comments