Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Run nunit tests with stable .NET version #7826

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-tools/automation/azure-pipelines-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ stages:
extraBuildArgs: /p:TestAvdApiLevel=$(avdApiLevel) /p:TestAvdAbi=$(avdAbi) /p:TestAvdType=$(avdType)
artifactSource: bin/Test$(XA.Build.Configuration)/Mono.Android_Tests-Signed.apk
artifactFolder: Default
useDotNet: false

- task: MSBuild@1
displayName: shut down emulator
Expand Down
21 changes: 12 additions & 9 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ stages:
testResultsFiles: TestResult-Xamarin.Android.JcwGen_Tests-$(ApkTestConfiguration).xml
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.JcwGen_Tests-Signed.apk
artifactFolder: Default
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -142,6 +143,7 @@ stages:
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.JcwGen_Tests-Signed.apk
artifactFolder: FastDev_Assemblies_Dexes
extraBuildArgs: /p:AndroidFastDeploymentType=Assemblies:Dexes
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -151,6 +153,7 @@ stages:
testResultsFiles: TestResult-Xamarin.Android.Locale_Tests-$(ApkTestConfiguration).xml
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.Locale_Tests-Signed.apk
artifactFolder: Default
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -161,6 +164,7 @@ stages:
extraBuildArgs: /p:AotAssemblies=True
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.Locale_Tests-Signed.apk
artifactFolder: Aot
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -171,6 +175,7 @@ stages:
extraBuildArgs: /p:AotAssemblies=True /p:AndroidEnableProfiledAot=true
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.Locale_Tests-Signed.apk
artifactFolder: Profiled-Aot
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -180,6 +185,7 @@ stages:
testResultsFiles: TestResult-Xamarin.Android.EmbeddedDSO_Test.nunit-$(ApkTestConfiguration).xml
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Android.EmbeddedDSO_Test-Signed.apk
artifactFolder: Default
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -189,6 +195,7 @@ stages:
testResultsFiles: TestResult-apkdiff-Xamarin.Forms_Performance_Integration-Signed-$(ApkTestConfiguration).xml
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk
artifactFolder: Default
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -199,6 +206,7 @@ stages:
extraBuildArgs: /p:AotAssemblies=true
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk
artifactFolder: Aot
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -209,6 +217,7 @@ stages:
extraBuildArgs: /p:AotAssemblies=True /p:AndroidEnableProfiledAot=true
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk
artifactFolder: Profiled-Aot
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -219,6 +228,7 @@ stages:
extraBuildArgs: /p:BundleAssemblies=true
artifactSource: bin/Test$(ApkTestConfiguration)/Xamarin.Forms_Performance_Integration-Signed.apk
artifactFolder: Bundle
useDotNet: false

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -228,6 +238,7 @@ stages:
testResultsFiles: TestResult-apkdiff-com.companyname.vsandroidapp-Signed-$(ApkTestConfiguration).xml
artifactSource: bin/Test$(ApkTestConfiguration)/com.companyname.vsandroidapp-Signed.apk
artifactFolder: Default
useDotNet: false

- task: MSBuild@1
displayName: shut down emulator
Expand Down Expand Up @@ -347,7 +358,6 @@ stages:
testResultsFiles: TestResult-Mono.Android.NET_Tests-$(XA.Build.Configuration).xml
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-$(XA.Build.Configuration)
useDotNet: true

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -358,7 +368,6 @@ stages:
testResultsFiles: TestResult-Mono.Android.NET_Tests-Debug.xml
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-Debug
useDotNet: true

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -369,7 +378,6 @@ stages:
extraBuildArgs: -p:TestsFlavor=NoAab -p:AndroidPackageFormat=apk
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.apk
artifactFolder: $(DotNetTargetFramework)-NoAab
useDotNet: true

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -380,7 +388,6 @@ stages:
extraBuildArgs: -p:TestsFlavor=Interpreter -p:UseInterpreter=True
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-Interpreter
useDotNet: true

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -391,7 +398,6 @@ stages:
extraBuildArgs: -p:TestsFlavor=NoAot -p:RunAOTCompilation=false
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-NoAot
useDotNet: true

- template: yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -402,7 +408,6 @@ stages:
extraBuildArgs: -p:TestsFlavor=AotLlvm -p:EnableLLVM=true -p:AndroidEnableProfiledAot=false
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Mono.Android.NET_Tests-Signed.aab
artifactFolder: $(DotNetTargetFramework)-AotLlvm
useDotNet: true

- task: MSBuild@1
displayName: shut down emulator
Expand Down Expand Up @@ -497,7 +502,6 @@ stages:

- template: yaml-templates/run-nunit-tests.yaml
parameters:
useDotNet: true
testRunTitle: MSBuildDeviceIntegration Smoke - macOS
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests $(DotNetNUnitCategories)"
Expand Down Expand Up @@ -546,7 +550,6 @@ stages:

- template: yaml-templates/run-nunit-tests.yaml
parameters:
useDotNet: true
testRunTitle: Xamarin.Android.Build.Tests - Linux .NET 6 Smoke Tests
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests $(DotNetNUnitCategories)"
Expand Down Expand Up @@ -739,7 +742,6 @@ stages:

- template: yaml-templates/run-nunit-tests.yaml
parameters:
useDotNet: true
testRunTitle: WearOS On Device - macOS
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll
dotNetTestExtraArgs: --filter "TestCategory = WearOS"
Expand Down Expand Up @@ -805,6 +807,7 @@ stages:
testResultsFiles: TestResult-Xamarin.Android.Bcl_Tests.nunit-$(XA.Build.Configuration).xml
artifactSource: bin/Test$(XA.Build.Configuration)/Xamarin.Android.Bcl_Tests-Signed.apk
artifactFolder: Default
useDotNet: false

- task: PublishTestResults@2
displayName: publish Xamarin.Android.Bcl-Tests-XUnit results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ parameters:
testResultsFormat: NUnit
artifactSource: ""
artifactFolder: ""
useDotNet: false
useDotNet: true
condition: succeeded()

steps:
Expand Down
2 changes: 1 addition & 1 deletion build-tools/automation/yaml-templates/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ stages:

- template: run-nunit-tests.yaml
parameters:
useDotNet: false
testRunTitle: Smoke MSBuild Tests - Windows Build Tree
testAssembly: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\net472\Xamarin.Android.Build.Tests.dll
testResultsFile: TestResult-SmokeMSBuildTests-WinBuildTree-$(XA.Build.Configuration).xml
nunitConsoleExtraArgs: --where "cat == SmokeTests"

- template: run-nunit-tests.yaml
parameters:
useDotNet: true
testRunTitle: Smoke MSBuild Tests - Windows Dotnet Build
testAssembly: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\$(DotNetStableTargetFramework)\Xamarin.Android.Build.Tests.dll
testResultsFile: TestResult-SmokeMSBuildTests-WinDotnetBuild-$(XA.Build.Configuration).xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
parameters:
testRunTitle: LocalizationTests On Device - macOS
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll
useDotNet: true
dotNetTestExtraArgs: --filter "Name~CheckLocalizationIsCorrectNode${{ parameters.node_id }}"
testResultsFile: TestResult-LocalizationTests-Node${{ parameters.node_id }}-$(XA.Build.Configuration).xml

Expand Down
26 changes: 22 additions & 4 deletions build-tools/automation/yaml-templates/run-nunit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ parameters:
testResultsFile: TestResult.xml
nunitConsoleExtraArgs: ''
dotNetTestExtraArgs: ''
useDotNet: false
useDotNet: true
useDotNetPreview: false
workers: $(NUnit.NumberOfTestWorkers)
condition: succeeded()
timeoutInMinutes: 0
retryCountOnTaskFailure: 0

steps:
- ${{ if eq(parameters.useDotNet, false) }}:
- ${{ if and(eq(parameters.useDotNet, false), eq(parameters.useDotNetPreview, false)) }}:
- powershell: |
Write-Host '##vso[task.setvariable variable=TestResultsFormat]NUnit'
if ([Environment]::OSVersion.Platform -eq "Unix") {
Expand All @@ -28,7 +31,7 @@ steps:
condition: ${{ parameters.condition }}
continueOnError: true

- ${{ if eq(parameters.useDotNet, true) }}:
- ${{ if and(eq(parameters.useDotNet, true), eq(parameters.useDotNetPreview, true)) }}:
- powershell: Write-Host '##vso[task.setvariable variable=TestResultsFormat]VSTest'
- template: run-dotnet-preview.yaml
parameters:
Expand All @@ -43,11 +46,26 @@ steps:
displayName: run ${{ parameters.testRunTitle }}
condition: ${{ parameters.condition }}

- ${{ if and(eq(parameters.useDotNet, true), eq(parameters.useDotNetPreview, false)) }}:
- task: DotNetCoreCLI@2
inputs:
command: test
projects: ${{ parameters.testAssembly }}
arguments: >-
${{ parameters.dotNetTestExtraArgs }} -- NUnit.NumberOfTestWorkers=${{ parameters.workers }}
publishTestResults: true
testRunTitle: ${{ parameters.testRunTitle }}
displayName: run ${{ parameters.testRunTitle }}
condition: ${{ parameters.condition }}
continueOnError: true
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
retryCountOnTaskFailure: ${{ parameters.retryCountOnTaskFailure }}

- template: kill-processes.yaml

- task: PublishTestResults@2
inputs:
testResultsFormat: $(TestResultsFormat)
testResultsFiles: ${{ parameters.testResultsFile }}
testRunTitle: ${{ parameters.testRunTitle }}
condition: ${{ parameters.condition }}
condition: and(${{ parameters.condition }}, or(ne('${{ parameters.useDotNet }}', 'true'), eq('${{ parameters.useDotNetPreview }}', 'true')))
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:

- template: run-nunit-tests.yaml
parameters:
useDotNet: false
testRunTitle: TimeZoneInfoTests On Device - macOS
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/net472/MSBuildDeviceIntegration.dll
nunitConsoleExtraArgs: --where "test == Xamarin.Android.Build.Tests.DeploymentTest.CheckTimeZoneInfoIsCorrectNode${{ parameters.node_id }}"
Expand Down
4 changes: 2 additions & 2 deletions build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ variables:
- name: NUnit.NumberOfTestWorkers
value: 4
- name: DotNetSdkVersion
value: 7.0.1xx
value: 7.0
- name: DotNetSdkQuality
value: preview
value: GA
- name: GitHub.Token
value: $(github--pat--vs-mobiletools-engineering-service2)
- name: HostedMacImage
Expand Down