Skip to content

Commit 0a67b86

Browse files
committed
Refactor to 'run-msbuild-tests'.
1 parent ef15fdb commit 0a67b86

File tree

2 files changed

+70
-84
lines changed

2 files changed

+70
-84
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
parameters:
2+
testOS: # 'macOS' or 'Windows'
3+
jobName: # Name of the job
4+
jobDisplayName: # Display name of the job
5+
agentCount: # Number of build agents to run in parallel
6+
testFilter: # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
7+
8+
jobs:
9+
- job: ${{ parameters.jobName }}
10+
strategy:
11+
parallel: ${{ parameters.agentCount }}
12+
displayName: ${{ parameters.jobDisplayName }}
13+
- ${{ if eq(parameters.testOS, 'Windows') }}:
14+
pool: $(1ESWindowsPool)
15+
- ${{ if eq(parameters.testOS, 'macOS') }}:
16+
pool:
17+
vmImage: $(HostedMacImage)
18+
timeoutInMinutes: 180
19+
cancelTimeoutInMinutes: 5
20+
variables:
21+
androidSdkPlatforms: 33
22+
steps:
23+
- ${{ if eq(parameters.testOS, 'Windows') }}:
24+
- script: netsh int ipv4 set global sourceroutingbehavior=drop
25+
26+
- template: kill-processes.yaml
27+
28+
- template: clean.yaml
29+
30+
- template: setup-test-environment.yaml
31+
parameters:
32+
provisionClassic: false
33+
installTestSlicer: true
34+
installApkDiff: false
35+
installLegacyDotNet: false
36+
restoreNUnitConsole: false
37+
updateMono: false
38+
39+
- task: DownloadPipelineArtifact@2
40+
inputs:
41+
artifactName: $(TestAssembliesArtifactName)
42+
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
43+
44+
- template: run-sliced-nunit-tests.yaml
45+
parameters:
46+
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
47+
testFilter: cat != SmokeTests ${{ parameters.nunit_categories }}
48+
testRunTitle: Xamarin.Android.Build.Tests - ${{ parameters.testOS }}
49+
testResultsTitle: TestResult-MSBuildTests-${{ parameters.jobName }}
50+
51+
- template: upload-results.yaml
52+
parameters:
53+
artifactName: Test Results - MSBuild - ${{ parameters.testOS }}-$(System.JobPositionInPhase)
54+
55+
- template: fail-on-issue.yaml
Lines changed: 15 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Runs MSBuild tests that do not require devices on Mac/Windows
22

33
parameters:
4-
mac_agent_count: 8
5-
win_agent_count: 4
64
nunit_categories: $(DotNetNUnitCategories)
7-
target_framework: $(DotNetStableTargetFramework)
85
stageCondition: succeeded()
96

107
stages:
@@ -13,84 +10,18 @@ stages:
1310
dependsOn: mac_build
1411
condition: ${{ parameters.stageCondition }}
1512
jobs:
16-
- job: mac_msbuild_tests
17-
strategy:
18-
parallel: ${{ parameters.mac_agent_count }}
19-
displayName: "macOS > Tests > MSBuild"
20-
pool:
21-
vmImage: $(HostedMacImage)
22-
timeoutInMinutes: 180
23-
cancelTimeoutInMinutes: 5
24-
workspace:
25-
clean: all
26-
variables:
27-
androidSdkPlatforms: 33
28-
steps:
29-
- template: setup-test-environment.yaml
30-
parameters:
31-
provisionClassic: false
32-
installTestSlicer: true
33-
installApkDiff: false
34-
installLegacyDotNet: false
35-
restoreNUnitConsole: false
36-
updateMono: false
37-
38-
- task: DownloadPipelineArtifact@2
39-
inputs:
40-
artifactName: $(TestAssembliesArtifactName)
41-
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
42-
43-
- template: run-sliced-nunit-tests.yaml
44-
parameters:
45-
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll
46-
testFilter: cat != SmokeTests ${{ parameters.nunit_categories }}
47-
testRunTitle: Xamarin.Android.Build.Tests - macOS
48-
testResultsTitle: TestResult-MSBuildTests-mac_msbuild_tests
49-
50-
- template: upload-results.yaml
51-
parameters:
52-
artifactName: Test Results - MSBuild - macOS-$(System.JobPositionInPhase)
53-
54-
- template: fail-on-issue.yaml
55-
56-
- job: win_msbuild_tests
57-
strategy:
58-
parallel: ${{ parameters.win_agent_count }}
59-
displayName: "Windows > Tests > MSBuild"
60-
pool: $(1ESWindowsPool)
61-
timeoutInMinutes: 180
62-
cancelTimeoutInMinutes: 5
63-
variables:
64-
androidSdkPlatforms: 33
65-
steps:
66-
- script: netsh int ipv4 set global sourceroutingbehavior=drop
67-
68-
- template: kill-processes.yaml
69-
70-
- template: clean.yaml
71-
72-
- template: setup-test-environment.yaml
73-
parameters:
74-
provisionClassic: false
75-
installTestSlicer: true
76-
installApkDiff: false
77-
installLegacyDotNet: false
78-
restoreNUnitConsole: false
79-
80-
- task: DownloadPipelineArtifact@2
81-
inputs:
82-
artifactName: $(TestAssembliesArtifactName)
83-
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
84-
85-
- template: run-sliced-nunit-tests.yaml
86-
parameters:
87-
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/${{ parameters.target_framework }}/Xamarin.Android.Build.Tests.dll
88-
testFilter: cat != SmokeTests ${{ parameters.nunit_categories }}
89-
testRunTitle: Xamarin.Android.Build.Tests - Windows
90-
testResultsTitle: TestResult-MSBuildTests-win_msbuild_tests
91-
92-
- template: upload-results.yaml
93-
parameters:
94-
artifactName: Test Results - MSBuild - Windows-$(System.JobPositionInPhase)
95-
96-
- template: fail-on-issue.yaml
13+
- template: run-msbuild-tests.yaml
14+
parameters:
15+
testOS: macOS
16+
jobName: mac_msbuild_tests
17+
jobDisplayName: macOS > Tests > MSBuild
18+
agentCount: 8
19+
testFilter: cat != SmokeTests ${{ parameters.nunit_categories }}
20+
21+
- template: run-msbuild-tests.yaml
22+
parameters:
23+
testOS: Windows
24+
jobName: win_msbuild_tests
25+
jobDisplayName: Windows > Tests > MSBuild
26+
agentCount: 4
27+
testFilter: cat != SmokeTests ${{ parameters.nunit_categories }}

0 commit comments

Comments
 (0)