Skip to content

Commit

Permalink
[ci] Run nunit tests with stable .NET version
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcollins committed Feb 24, 2023
1 parent a65c8d8 commit 29c5610
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
3 changes: 0 additions & 3 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,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 +545,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 +737,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
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 }}, eq('${{ parameters.useDotNet }}', 'true'), eq('${{ parameters.useDotNetPreview }}', 'false'))
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

0 comments on commit 29c5610

Please sign in to comment.