Skip to content

Commit

Permalink
upgraded the build/CI to use net8.0 (#4876)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting authored Oct 2, 2023
1 parent bb57319 commit 8ea6bb9
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-instrumentation-libraries-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-instrumentation-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand All @@ -31,7 +31,7 @@ jobs:
strategy:
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ windows-latest, ubuntu-latest ]
version: [ net462, net6.0, net7.0 ]
version: [ net462, net6.0, net7.0, net8.0 ]
exclude:
- os: ubuntu-latest
version: net462
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration-md.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [net6.0,net7.0]
version: [ net6.0, net7.0, net8.0 ]
steps:
- run: 'echo "No build required"'

w3c-trace-context-test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [net6.0,net7.0]
version: [ net6.0, net7.0, net8.0 ]
steps:
- run: 'echo "No build required"'

otlp-exporter-test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [net6.0,net7.0]
version: [ net6.0, net7.0 , net8.0 ]
steps:
- run: 'echo "No build required"'
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [net6.0,net7.0]
version: [ net6.0, net7.0 ]
steps:
- uses: actions/checkout@v4

Expand All @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [net6.0,net7.0]
version: [ net6.0, net7.0, net8.0 ]
steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<TargetFrameworksForPrometheusAspNetCore>net6.0</TargetFrameworksForPrometheusAspNetCore>

<!-- non-production TFMs -->
<TargetFrameworksForAspNetCoreTests>net7.0;net6.0</TargetFrameworksForAspNetCoreTests>
<TargetFrameworksForAspNetCoreTests>net8.0;net7.0;net6.0</TargetFrameworksForAspNetCoreTests>
<TargetFrameworksForAotCompatibilityTests>net8.0</TargetFrameworksForAotCompatibilityTests>
<TargetFrameworksForDocs>net7.0;net6.0</TargetFrameworksForDocs>
<TargetFrameworksForDocs Condition="$(OS) == 'Windows_NT' And '$(UsingMicrosoftNETSdkWeb)' == 'False'">
$(TargetFrameworksForDocs);net481;net48;net472;net471;net47;net462
</TargetFrameworksForDocs>
<TargetFrameworksForTests>net7.0;net6.0</TargetFrameworksForTests>
<TargetFrameworksForTests>net8.0;net7.0;net6.0</TargetFrameworksForTests>
<TargetFrameworksForTests Condition="$(OS) == 'Windows_NT'">
$(TargetFrameworksForTests);net462
</TargetFrameworksForTests>
Expand Down
9 changes: 9 additions & 0 deletions build/docker-compose.net8.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3.7'

services:
tests:
build:
args:
PUBLISH_FRAMEWORK: net8.0
TEST_SDK_VERSION: "8.0"
BUILD_SDK_VERSION: "8.0"
34 changes: 17 additions & 17 deletions test/OpenTelemetry.Api.Tests/Trace/TracerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public void Tracer_StartRootSpan_BadArgs_NullSpanName()
.Build();

var span1 = this.tracer.StartRootSpan(null);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartRootSpan(null, SpanKind.Client);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));

var span3 = this.tracer.StartRootSpan(null, SpanKind.Client, default);
Assert.Null(span3.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span3.Activity.DisplayName));
}

[Fact]
Expand Down Expand Up @@ -118,13 +118,13 @@ public void Tracer_StartSpan_BadArgs_NullSpanName()
.Build();

var span1 = this.tracer.StartSpan(null);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartSpan(null, SpanKind.Client);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));

var span3 = this.tracer.StartSpan(null, SpanKind.Client, null);
Assert.Null(span3.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span3.Activity.DisplayName));
}

[Fact]
Expand All @@ -135,13 +135,13 @@ public void Tracer_StartActiveSpan_BadArgs_NullSpanName()
.Build();

var span1 = this.tracer.StartActiveSpan(null);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartActiveSpan(null, SpanKind.Client);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));

var span3 = this.tracer.StartActiveSpan(null, SpanKind.Client, null);
Assert.Null(span3.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span3.Activity.DisplayName));
}

[Fact]
Expand All @@ -152,10 +152,10 @@ public void Tracer_StartSpan_FromParent_BadArgs_NullSpanName()
.Build();

var span1 = this.tracer.StartSpan(null, SpanKind.Client, TelemetrySpan.NoopInstance);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartSpan(null, SpanKind.Client, TelemetrySpan.NoopInstance, default);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));
}

[Fact]
Expand All @@ -168,10 +168,10 @@ public void Tracer_StartSpan_FromParentContext_BadArgs_NullSpanName()
var blankContext = default(SpanContext);

var span1 = this.tracer.StartSpan(null, SpanKind.Client, blankContext);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartSpan(null, SpanKind.Client, blankContext, default);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));
}

[Fact]
Expand All @@ -182,10 +182,10 @@ public void Tracer_StartActiveSpan_FromParent_BadArgs_NullSpanName()
.Build();

var span1 = this.tracer.StartActiveSpan(null, SpanKind.Client, TelemetrySpan.NoopInstance);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartActiveSpan(null, SpanKind.Client, TelemetrySpan.NoopInstance, default);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));
}

[Fact]
Expand All @@ -198,10 +198,10 @@ public void Tracer_StartActiveSpan_FromParentContext_BadArgs_NullSpanName()
var blankContext = default(SpanContext);

var span1 = this.tracer.StartActiveSpan(null, SpanKind.Client, blankContext);
Assert.Null(span1.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span1.Activity.DisplayName));

var span2 = this.tracer.StartActiveSpan(null, SpanKind.Client, blankContext, default);
Assert.Null(span2.Activity.DisplayName);
Assert.True(string.IsNullOrEmpty(span2.Activity.DisplayName));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# This should be run from the root of the repo:
# docker build --file test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/IntegrationTest/Dockerfile

ARG BUILD_SDK_VERSION=7.0
ARG TEST_SDK_VERSION=7.0
ARG BUILD_SDK_VERSION=8.0
ARG TEST_SDK_VERSION=8.0

FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build
ARG PUBLISH_CONFIGURATION=Release
ARG PUBLISH_FRAMEWORK=net7.0
ARG PUBLISH_FRAMEWORK=net8.0
WORKDIR /repo
COPY . ./
WORKDIR "/repo/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.Extensions.Http" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
<PackageReference Include="Grpc.AspNetCore.Server" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Prometheus.AspNetCore\OpenTelemetry.Exporter.Prometheus.AspNetCore.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.Text.RegularExpressions;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand Down Expand Up @@ -112,7 +113,7 @@ public Task PrometheusExporterMiddlewareIntegration_MixedPredicateAndPath()
path: "/metrics_path",
configureBranchedPipeline: branch => branch.Use((context, next) =>
{
context.Response.Headers.Add("X-MiddlewareExecuted", "true");
context.Response.Headers.Append("X-MiddlewareExecuted", "true");
return next();
}),
optionsName: null),
Expand All @@ -139,7 +140,7 @@ public Task PrometheusExporterMiddlewareIntegration_MixedPath()
path: "/metrics_path",
configureBranchedPipeline: branch => branch.Use((context, next) =>
{
context.Response.Headers.Add("X-MiddlewareExecuted", "true");
context.Response.Headers.Append("X-MiddlewareExecuted", "true");
return next();
}),
optionsName: null),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.
// </copyright>

#if NET6_0_OR_GREATER
using System.Diagnostics;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -85,4 +84,3 @@ public async void Dispose()
await this.app.DisposeAsync().ConfigureAwait(false);
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<Compile Include="$(RepoRoot)\test\OpenTelemetry.Tests\Shared\TestEventListener.cs" Link="Includes\TestEventListener.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
</ItemGroup>

Expand Down

0 comments on commit 8ea6bb9

Please sign in to comment.