Skip to content

Commit

Permalink
Add NET 5.0 testing (Azure#16947)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym authored Nov 23, 2020
1 parent a3bd0be commit f240ef2
Show file tree
Hide file tree
Showing 115 changed files with 597 additions and 546 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- Install VS 2019 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
- Need at least .NET Framework 4.6.1 and 4.7 development tools
- Install the **.NET Core cross-platform development** workloads in VisualStudio
- Install **.NET Core 3.1.301 SDK** for your specific platform. (or a higher version within the 3.1.*** band) (https://dotnet.microsoft.com/download/dotnet-core/3.1)
- Install **.NET Core 5.0.100 SDK** for your specific platform. (or a higher version within the 5.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/3.1)
- Install the latest version of git (https://git-scm.com/downloads)
- Install [NodeJS](https://nodejs.org/en/) (14.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).

Expand Down
6 changes: 3 additions & 3 deletions eng/Directory.Build.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<UpdateSourceOnBuild Condition="'$(UpdateSourceOnBuild)' == ''">$(AZURE_DEV_UPDATESOURCESONBUILD)</UpdateSourceOnBuild>
<PowerShellExe Condition="'$(PowerShellExe)' == ''">pwsh</PowerShellExe>
<CoverletOutputFormat Condition="'$(CoverletOutputFormat)' == '' and '$(CollectCoverage)' == 'true'">cobertura</CoverletOutputFormat>
<InheritDocEnabled>true</InheritDocEnabled>
<InheritDocEnabled>false</InheritDocEnabled>
</PropertyGroup>

<PropertyGroup Condition="'$(IsShippingClientLibrary)' == 'true' and '$(TF_BUILD)' == 'true'">
Expand Down Expand Up @@ -92,8 +92,8 @@

<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'">
<IsPackable>false</IsPackable>
<RequiredTargetFrameworks>netcoreapp2.1</RequiredTargetFrameworks>
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">netcoreapp2.1;net461</RequiredTargetFrameworks>
<RequiredTargetFrameworks>netcoreapp2.1;net5.0</RequiredTargetFrameworks>
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">netcoreapp2.1;net5.0;net461</RequiredTargetFrameworks>
</PropertyGroup>

<Import Project="$(RepoRoot)/sdk/core/Azure.Core/src/Azure.Core.props" Condition="'$(IsMgmtClientLibrary)' == 'true'"/>
Expand Down
2 changes: 1 addition & 1 deletion eng/Directory.Build.Data.targets
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<ItemGroup Condition="'$(IsMgmtClientLibrary)' == 'true' and '$(IsTestProject)' == 'true'">
<ProjectReference Include="$(AzureCoreTestFramework)" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="nunit" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
Expand Down
4 changes: 2 additions & 2 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Update="ApprovalTests" Version="3.0.22" />
<PackageReference Update="ApprovalUtilities" Version="3.0.22" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20201028.2" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20201113.1" />
<PackageReference Update="Azure.AI.FormRecognizer" Version="3.0.0" />
<PackageReference Update="Azure.AI.TextAnalytics" Version="5.0.0" />
<PackageReference Update="Azure.Data.AppConfiguration" Version="1.0.0" />
Expand Down Expand Up @@ -87,7 +87,7 @@
<PackageReference Update="MSTest.TestFramework" Version="1.3.2" />
<PackageReference Update="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Update="NSubstitute" Version="3.1.0" />
<PackageReference Update="nunit" Version="3.12.0" />
<PackageReference Update="NUnit" Version="3.12.0" />
<PackageReference Update="NUnit3TestAdapter" Version="3.13.0" />
<PackageReference Update="OpenTelemetry" Version="0.8.0-beta.1" />
<PackageReference Update="OpenTelemetry.Extensions.Hosting" Version="0.8.0-beta.1" />
Expand Down
11 changes: 7 additions & 4 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
displayName: 'Use Python 3.6'
inputs:
versionSpec: '3.6'
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: >-
dotnet pack eng/service.proj -warnaserror
/p:ServiceDirectory=${{ parameters.ServiceDirectory }}
Expand All @@ -45,7 +46,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
- template: ../steps/archetype-sdk-docs.yml
parameters:
ServiceDirectory: ${{parameters.ServiceDirectory}}
Expand Down Expand Up @@ -88,15 +88,15 @@ jobs:
inputs:
versionSpec: '14.x'
displayName: 'Install NodeJS'
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- task: PowerShell@2
displayName: "Verify generated code"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
inputs:
filePath: "eng/scripts/CodeChecks.ps1"
arguments: -ServiceDirectory ${{parameters.ServiceDirectory}}
arguments: -ServiceDirectory ${{parameters.ServiceToTest}}
pwsh: true
failOnStderr: false
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
Expand Down Expand Up @@ -133,13 +133,17 @@ jobs:
MacOs:
OSVmImage: "macOS-10.15"
TestTargetFramework: netcoreapp2.1
Windows_Net50:
OSVmImage: "windows-2019"
TestTargetFramework: net5.0
pool:
vmImage: "$(OSVmImage)"
steps:
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
- ${{ each step in parameters.TestSetupSteps }}:
- ${{ each pair in step }}:
${{ pair.key }}: ${{ pair.value }}
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: >-
dotnet test eng/service.proj --filter TestCategory!=Live --framework $(TestTargetFramework)
--logger "trx;LogFileName=$(TestTargetFramework).trx" --logger:"console;verbosity=normal"
Expand All @@ -150,7 +154,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishTestResults@2
condition: always()
displayName: "Publish Results ($(TestTargetFramework))"
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/templates/jobs/archetype-sdk-mgmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ jobs:
vmImage: windows-2019
steps:
#- script: "echo $(system.pullrequest.pullrequestnumber), https://github.com/$(build.repository.id), https://github.com/$(build.repository.ID)"
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: |
if "$(BuildConfiguration)" == "Release" (set SkipTests=true) else (set SkipTests=false)
dotnet msbuild mgmt.proj /v:m /t:CreateNugetPackage /p:Configuration=$(BuildConfiguration) /p:SkipTests=%SkipTests% /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:Scope=${{parameters.Scope}} /p:ForPublishing=$(ShouldPublish) $(loggingArgs) $(RPScopeArgs)"
displayName: "Build & Package"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
inputs:
Expand Down Expand Up @@ -46,12 +46,12 @@ jobs:
steps:
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
- script: "echo $(system.pullrequest.pullrequestnumber), http://github.com/$(build.repository.id), http://github.com/$(build.repository.ID)"
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- script: "dotnet msbuild mgmt.proj /v:n /t:RunTests /p:Scope=${{parameters.Scope}} /p:ForPublishing=$(ShouldPublish) /clp:ShowtimeStamp $(RPScopeArgs)"
displayName: "Build & Run Tests"
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
Expand Down
3 changes: 1 addition & 2 deletions eng/pipelines/templates/jobs/archetype-sdk-tests-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
Write-Host "##vso[task.setvariable variable=TestMode]Record"
}
displayName: Set Test Mode
- template: /eng/pipelines/templates/steps/install-dotnet.yml
- pwsh: >
dotnet test eng/service.proj
--framework $(TestTargetFramework)
Expand All @@ -101,7 +101,6 @@ jobs:
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_MULTILEVEL_LOOKUP: 0
AZURE_TEST_MODE: $(TestMode)
${{ each var in parameters.EnvVars }}:
${{ var.key }}: ${{ var.value }}
Expand Down
12 changes: 12 additions & 0 deletions eng/pipelines/templates/steps/install-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK'
inputs:
useGlobalJson: true
performMultiLevelLookup: true
- task: UseDotNet@2
condition: ne(variables['Agent.OS'], 'Windows_NT') # Windows supports MultiLevelLookup and doesn't need explicit framework installation
displayName: 'Use .NET Core 2.1 runtime'
inputs:
packageType: runtime
version: "2.1.x"
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Microsoft.Build.Traversal": "1.0.45"
},
"sdk": {
"version": "3.1.301",
"version": "5.0.100",
"rollForward": "feature"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
Expand Down
Loading

0 comments on commit f240ef2

Please sign in to comment.