Skip to content

Commit

Permalink
Enable netcoreapp2.1 (#780)
Browse files Browse the repository at this point in the history
updating yml

Revert "updating yml"

This reverts commit 391f3baadbca0de4b3e2d78b35db38eb7e7bddbc.

installing dotnet 2.1 and 3.1

updating yml to enable multiple dotnet versions

adding matrix condition

disable dotnet 2.1 for windows

removing unused package reference

Revert "removing unused package reference"

This reverts commit 0d898aa044f916743da613a83539f568bff3ad49.

updating yml

adding cov.yml to sln

Add resources to instrumentation (#779)

* Add resources to instrumentation

* Unit test activitysourcedapter

Co-authored-by: Sergey Kanzhelev <[email protected]>

disabling ubuntu-latest to codecoverage

removing extra steps

adding codecov.yml

moving file

Co-authored-by: Cijo Thomas <[email protected]>
  • Loading branch information
eddynaka and cijothomas authored Jul 8, 2020
1 parent c5e5604 commit 0973b3e
Show file tree
Hide file tree
Showing 25 changed files with 409 additions and 22 deletions.
20 changes: 20 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "50...100"

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
8 changes: 4 additions & 4 deletions .github/workflows/dotnet-core-cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [windows-latest]
env:
OS: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Setup .NET Core
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

dotnet-version: 3.1.301
- name: Install dependencies
run: dotnet restore

Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/dotnet-core-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@ jobs:

strategy:
matrix:
version: [netcoreapp3.1]
version: [netcoreapp2.1,netcoreapp3.1]

steps:
- uses: actions/checkout@v2

- name: Setup .NET Core
- name: Setup .NET Core 2.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: 2.1.807

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301

# For linux, we have to apply a workaround to enable both dotnet versions at same time
- name: .net SxS
run: |
rsync -a ${DOTNET_ROOT/3.1.301/2.1.807}/* $DOTNET_ROOT/
- name: Install dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-core-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
version: [net452,net46,net461,netcoreapp3.1]
version: [net452,net46,net461,netcoreapp2.1,netcoreapp3.1]

steps:
- uses: actions/checkout@v2
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/dotnet-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@ jobs:
with:
fetch-depth: 0 # fetching all

- name: Setup .NET Core
- name: Setup .NET Core 2.1
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
dotnet-version: 2.1.807

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.301

# For linux, we have to apply a workaround to enable both dotnet versions at same time
- name: .net SxS
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
rsync -a ${DOTNET_ROOT/3.1.301/2.1.807}/* $DOTNET_ROOT/
- name: Install dependencies
run: dotnet restore
Expand Down
8 changes: 8 additions & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEM
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{E69578EB-B456-4062-A645-877CD964528B}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet-core-cov.yml = .github\workflows\dotnet-core-cov.yml
.github\workflows\dotnet-core-linux.yml = .github\workflows\dotnet-core-linux.yml
.github\workflows\dotnet-core-win.yml = .github\workflows\dotnet-core-win.yml
.github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
Expand All @@ -135,6 +136,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{D2E73927-5
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Instrumentation.GrpcClient.Tests", "test\OpenTelemetry.Instrumentation.GrpcClient.Tests\OpenTelemetry.Instrumentation.GrpcClient.Tests.csproj", "{305E9DFD-E73B-4A28-8769-795C25551020}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestApp.AspNetCore.2.1", "test\TestApp.AspNetCore.2.1\TestApp.AspNetCore.2.1.csproj", "{7CDA3F85-EA6F-45C4-B432-2559303355D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -265,6 +268,10 @@ Global
{305E9DFD-E73B-4A28-8769-795C25551020}.Debug|Any CPU.Build.0 = Debug|Any CPU
{305E9DFD-E73B-4A28-8769-795C25551020}.Release|Any CPU.ActiveCfg = Release|Any CPU
{305E9DFD-E73B-4A28-8769-795C25551020}.Release|Any CPU.Build.0 = Release|Any CPU
{7CDA3F85-EA6F-45C4-B432-2559303355D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CDA3F85-EA6F-45C4-B432-2559303355D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CDA3F85-EA6F-45C4-B432-2559303355D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CDA3F85-EA6F-45C4-B432-2559303355D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -279,6 +286,7 @@ Global
{E69578EB-B456-4062-A645-877CD964528B} = {F1D0972B-38CF-49C2-9F4B-4C5DE02FB71D}
{C1542297-8763-4DF4-957C-489ED771C21D} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
{D2E73927-5966-445C-94E9-EFE6F269C8D5} = {7CB2F02E-03FA-4FFF-89A5-C51F107623FD}
{7CDA3F85-EA6F-45C4-B432-2559303355D4} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for Jaeger Exporter for OpenTelemetry</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net46</TargetFrameworks>

<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net46</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<Description>Unit test project for Prometheus Exporter for OpenTelemetry</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net46</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -14,14 +14,17 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp2.1' AND '$(TargetFramework)' != 'netcoreapp3.1' ">
<Reference Include="System.Net.Http" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for Zipkin Exporter for OpenTelemetry</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net461</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry .NET Core hosting library</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
using OpenTelemetry.Trace;
using OpenTelemetry.Trace.Configuration;
using OpenTelemetry.Trace.Export;
#if NETCOREAPP2_1
using TestApp.AspNetCore._2._1;
#else
using TestApp.AspNetCore._3._1;
#endif
using Xunit;

namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
using OpenTelemetry.Trace;
using OpenTelemetry.Trace.Configuration;
using OpenTelemetry.Trace.Export;
#if NETCOREAPP2_1
using TestApp.AspNetCore._2._1;
#else
using TestApp.AspNetCore._3._1;
#endif
using Xunit;

namespace OpenTelemetry.Instrumentation.AspNetCore.Tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry ASP.NET Core instrumentation</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -28,9 +28,19 @@
<ItemGroup>
<ProjectReference Include="..\..\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
<ProjectReference Include="..\..\src\OpenTelemetry\OpenTelemetry.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<ProjectReference Include="..\TestApp.AspNetCore.3.1\TestApp.AspNetCore.3.1.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<ProjectReference Include="..\TestApp.AspNetCore.2.1\TestApp.AspNetCore.2.1.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Net.Http" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry dependency instrumentations</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net452;net461</TargetFrameworks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry StackExchangeRedis instrumentation</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net461</TargetFrameworks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry.Shims.OpenTracing</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Unit test project for OpenTelemetry</Description>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);net46;net452</TargetFrameworks>
</PropertyGroup>

Expand Down
48 changes: 48 additions & 0 deletions test/TestApp.AspNetCore.2.1/CallbackMiddleware.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// <copyright file="CallbackMiddleware.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;

namespace TestApp.AspNetCore._2._1
{
public class CallbackMiddleware
{
private readonly CallbackMiddlewareImpl impl;
private readonly RequestDelegate next;

public CallbackMiddleware(RequestDelegate next, CallbackMiddlewareImpl impl)
{
this.next = next;
this.impl = impl;
}

public async Task InvokeAsync(HttpContext context)
{
if (this.impl == null || await this.impl.ProcessAsync(context))
{
await this.next(context);
}
}

public class CallbackMiddlewareImpl
{
public virtual async Task<bool> ProcessAsync(HttpContext context)
{
return await Task.FromResult(true);
}
}
}
}
Loading

0 comments on commit 0973b3e

Please sign in to comment.