Skip to content

Commit

Permalink
Run IntegrationTests on .NET Core 3.0 (DataDog#520)
Browse files Browse the repository at this point in the history
- Edit tests project, sample projects, and reproduction projects to additionally run against `netcoreapp3.0`
- Edit unit tests using the `TargetFrameworkVersionsFact` to run against `netcoreapp3.0` if they already run against `netcoreapp2.1`
- Use the `UseDotNet@2` task to install the .NET Core SDK's in all of our test pipelines. Also, install the .NET Core 3.0 SDK in all of our pipelines.
- Split the Linux integration-tests into two separate runs: `netcoreapp2.1` and `netcoreapp3.0`
- Edit the `GeneratePackageVersions` tool to allow specifying only one `TargetFramework` for a sample app to run against (needed for `Samples.AspNetCoreMvc2`), and filter the sample apps to publish by `TargetFramework`
  • Loading branch information
zacharycmontoya authored Oct 1, 2019
1 parent 45a3301 commit dfd0ec4
Show file tree
Hide file tree
Showing 51 changed files with 406 additions and 345 deletions.
66 changes: 42 additions & 24 deletions .azure-pipelines/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,44 @@ trigger:
variables:
buildConfiguration: Debug
packageFeed: /ffc32c57-3e0e-4e8f-8633-a7ad01df2e45
dotnetCoreSdkVersion: 2.2.401
dotnetCoreSdkVersion: 3.0.x
dotnetCore21SdkVersion: 2.1.x
publishOutput: $(Build.SourcesDirectory)/src/bin/managed-publish

jobs:

- job: Linux
strategy:
matrix:
netcoreapp2_1:
publishTargetFramework: netcoreapp2.1
netcoreapp3_0:
publishTargetFramework: netcoreapp3.0

pool:
vmImage: ubuntu-16.04

variables:
TestAllPackageVersions: true

steps:
- task: DockerCompose@0
displayName: docker-compose run build
inputs:
containerregistrytype: Container Registry
dockerComposeCommand: run -e TestAllPackageVersions=true build
dockerComposeCommand: run -e TestAllPackageVersions=true -e buildConfiguration=$(buildConfiguration) -e publishTargetFramework=$(publishTargetFramework) build

- task: DockerCompose@0
displayName: docker-compose run Profiler
inputs:
containerregistrytype: Container Registry
dockerComposeFileArgs: TestAllPackageVersions=true
dockerComposeCommand: run Profiler

- task: DockerCompose@0
displayName: docker-compose run IntegrationTests
inputs:
containerregistrytype: Container Registry
dockerComposeCommand: run -e TestAllPackageVersions=true IntegrationTests
dockerComposeCommand: run -e TestAllPackageVersions=true -e buildConfiguration=$(buildConfiguration) -e publishTargetFramework=$(publishTargetFramework) IntegrationTests

- task: PublishTestResults@2
displayName: publish test results
Expand All @@ -58,10 +67,11 @@ jobs:
buildPlatform: 'x64'

steps:
- task: DotNetCoreInstaller@0
displayName: install dotnet core sdk
- task: UseDotNet@2
displayName: install dotnet core 2.1 sdk
inputs:
version: $(dotnetCoreSdkVersion)
packageType: sdk
version: $(dotnetCore21SdkVersion)

- task: DotNetCoreCLI@2
displayName: dotnet build src/**/*.csproj
Expand Down Expand Up @@ -117,6 +127,31 @@ jobs:
msbuildArguments: /t:BuildCpp
maximumCpuCount: true

- task: NuGetCommand@2
displayName: 'nuget restore reproductions/**/packages.config'
inputs:
restoreSolution: reproductions/**/packages.config
restoreDirectory: $(Build.SourcesDirectory)/packages
vstsFeed: $(packageFeed)
verbosityRestore: Normal

- task: MSBuild@1
displayName: 'Build .NET Framework projects (not SDK-based projects)'
inputs:
solution: Datadog.Trace.proj
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArguments: '/t:BuildFrameworkReproductions'
maximumCpuCount: true

# Install the .NET Core 3.0 SDK and use it from here on out, since it is only
# the .NET Core sample apps that require the .NET Core 3.0 SDK
- task: UseDotNet@2
displayName: install dotnet core 3.0 sdk
inputs:
packageType: sdk
version: $(dotnetCoreSdkVersion)

- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
Expand All @@ -141,23 +176,6 @@ jobs:
!reproductions/**/EntityFramework6x*.csproj
arguments: --configuration $(buildConfiguration) -p:Platform=$(buildPlatform) -p:ManagedProfilerOutputDirectory=$(publishOutput)

- task: NuGetCommand@2
displayName: 'nuget restore reproductions/**/packages.config'
inputs:
restoreSolution: reproductions/**/packages.config
restoreDirectory: $(Build.SourcesDirectory)/packages
vstsFeed: $(packageFeed)
verbosityRestore: Normal

- task: MSBuild@1
displayName: 'Build .NET Framework projects (not SDK-based projects)'
inputs:
solution: Datadog.Trace.proj
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArguments: '/t:BuildFrameworkReproductions'
maximumCpuCount: true

# - task: MSBuild@1
# displayName: 'Build sample apps (x64 or x86)'
# inputs:
Expand Down
7 changes: 4 additions & 3 deletions .azure-pipelines/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pr: none
variables:
buildConfiguration: release
packageFeed: /ffc32c57-3e0e-4e8f-8633-a7ad01df2e45
dotnetCoreSdkVersion: 2.2.401
dotnetCoreSdkVersion: 3.0.x
publishOutput: $(Build.SourcesDirectory)/src/bin/managed-publish

jobs:
Expand Down Expand Up @@ -58,9 +58,10 @@ jobs:
msbuildArguments: /t:BuildCpp
maximumCpuCount: true

- task: DotNetCoreInstaller@0
- task: UseDotNet@2
displayName: install dotnet core sdk
inputs:
packageType: sdk
version: $(dotnetCoreSdkVersion)

- task: DotNetCoreCLI@2
Expand Down Expand Up @@ -145,7 +146,7 @@ jobs:
vmImage: ubuntu-16.04

steps:
- task: DotNetCoreInstaller@0
- task: UseDotNet@2
displayName: install dotnet core sdk
inputs:
version: $(dotnetCoreSdkVersion)
Expand Down
24 changes: 17 additions & 7 deletions .azure-pipelines/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ trigger:
variables:
buildConfiguration: Debug
packageFeed: /ffc32c57-3e0e-4e8f-8633-a7ad01df2e45
dotnetCoreSdkVersion: 2.2.401
dotnetCoreSdkVersion: 3.0.x
dotnetCore21SdkVersion: 2.1.x

jobs:

Expand All @@ -27,9 +28,16 @@ jobs:
vmImage: $(imageName)

steps:
- task: DotNetCoreInstaller@0
displayName: install dotnet core sdk
- task: UseDotNet@2
displayName: install dotnet core 2.1 sdk
inputs:
packageType: sdk
version: $(dotnetCore21SdkVersion)

- task: UseDotNet@2
displayName: install dotnet core 3.0 sdk
inputs:
packageType: sdk
version: $(dotnetCoreSdkVersion)

- task: DotNetCoreCLI@2
Expand Down Expand Up @@ -69,18 +77,20 @@ jobs:
vmImage: windows-2019

steps:
- task: DotNetCoreInstaller@0
displayName: install dotnet core sdk
- task: UseDotNet@2
displayName: install dotnet core 2.1 sdk
inputs:
version: $(dotnetCoreSdkVersion)
packageType: sdk
version: $(dotnetCore21SdkVersion)

- task: DotNetCoreCLI@2
displayName: dotnet build Datadog.Trace.ClrProfiler.Managed.Loader
displayName: dotnet build
inputs:
command: build
configuration: $(buildConfiguration)
projects: |
src/Datadog.Trace.ClrProfiler.Managed.Loader/Datadog.Trace.ClrProfiler.Managed.Loader.csproj
sample-libs/**/Samples.ExampleLibrary*.csproj
- task: NuGetCommand@2
displayName: nuget restore
Expand Down
22 changes: 18 additions & 4 deletions Datadog.Trace.proj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<CppProject Include="src\**\*.vcxproj"/>
<CppTestProject Include="test\**\*.vcxproj"/>
<SampleProject Include="samples*\**\*.csproj"/>
<SampleLibProject Include="sample-libs\**\*.csproj"/>
<WindowsInstallerProject Include="deploy\**\*.wixproj"/>
</ItemGroup>

Expand Down Expand Up @@ -67,18 +68,31 @@

<!-- Build the core C# projects first, so that the sample project builds do not need to build them and can be run
concurrently -->
<MSBuild Targets="Restore" Projects="@(CsharpProject)" BuildInParallel="false">
<MSBuild Targets="Restore" Projects="@(CsharpProject)" BuildInParallel="false" RemoveProperties="TargetFramework">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>
<MSBuild Targets="Build" Projects="@(CsharpProject)" BuildInParallel="false">
<MSBuild Targets="Build" Projects="@(CsharpProject)" BuildInParallel="false" RemoveProperties="TargetFramework">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>

<!-- Build the sample-libs projects next in case any sample projects rely on them -->
<MSBuild Targets="Restore" Projects="@(SampleLibProject)" BuildInParallel="false" RemoveProperties="TargetFramework">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>
<MSBuild Targets="Build" Projects="@(SampleLibProject)" BuildInParallel="false" RemoveProperties="TargetFramework">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>

<!-- Filter the sample projects by TargetFramework -->
<ItemGroup>
<PackageVersionSampleCompile Include="@(PackageVersionSample)" Condition="'%(PackageVersionSample.TargetFramework)' == '' or '%(PackageVersionSample.TargetFramework)'=='$(TargetFramework)'" />
</ItemGroup>

<!-- Build the sample projects concurrently -->
<MSBuild Targets="Restore" Projects="@(PackageVersionSample)" BuildInParallel="$(BuildInParallel)">
<MSBuild Targets="Restore" Projects="@(PackageVersionSampleCompile)" BuildInParallel="$(BuildInParallel)">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>
<MSBuild Targets="Publish" Projects="@(PackageVersionSample)" BuildInParallel="$(BuildInParallel)">
<MSBuild Targets="Publish" Projects="@(PackageVersionSampleCompile)" BuildInParallel="$(BuildInParallel)">
<Output TaskParameter="TargetOutputs" ItemName="CollectedBuildOutput"/>
</MSBuild>
</Target>
Expand Down
Loading

0 comments on commit dfd0ec4

Please sign in to comment.