Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[repo] CI updates #4016

Merged
merged 7 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/apicompatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- uses: actions/setup-dotnet@v3.0.3

- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '7.0.x'

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
with:
fetch-depth: 0 # fetching all

- uses: actions/setup-dotnet@v3.0.3
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '7.0.x'

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetching all
- uses: actions/setup-dotnet@v3.0.3

- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '7.0.x'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: check out code
uses: actions/checkout@v3

- name: Setup .NET Core 7.0
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '7.0.x'
Expand Down
6 changes: 3 additions & 3 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: [net7.0]
version: [net6.0,net7.0]
steps:
- uses: actions/checkout@v3

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

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

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/publish-packages-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
fetch-depth: 0 # fetching all
ref: ${{ github.ref || 'main' }}

- uses: actions/setup-dotnet@v3.0.3
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: '7.0.x'

Expand Down
2 changes: 1 addition & 1 deletion OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
build\Common.props = build\Common.props
build\debug.snk = build\debug.snk
build\docfx.cmd = build\docfx.cmd
build\docker-compose.net6.0.yml = build\docker-compose.net6.0.yml
build\docker-compose.net7.0.yml = build\docker-compose.net7.0.yml
build\docker-compose.netcoreapp3.1.yml = build\docker-compose.netcoreapp3.1.yml
build\finalize-publicapi.ps1 = build\finalize-publicapi.ps1
build\GlobalAttrExclusions.txt = build\GlobalAttrExclusions.txt
build\opentelemetry-icon-color.png = build\opentelemetry-icon-color.png
Expand Down
9 changes: 9 additions & 0 deletions build/docker-compose.net6.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: net6.0
TEST_SDK_VERSION: 6.0
BUILD_SDK_VERSION: 7.0
3 changes: 2 additions & 1 deletion build/docker-compose.net7.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ services:
build:
args:
PUBLISH_FRAMEWORK: net7.0
SDK_VERSION: 7.0
TEST_SDK_VERSION: 7.0
BUILD_SDK_VERSION: 7.0
8 changes: 0 additions & 8 deletions build/docker-compose.netcoreapp3.1.yml

This file was deleted.

2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"rollForward": "latestFeature",
"version": "7.0.100"
"version": "7.0.101"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
# This should be run from the root of the repo:
# docker build --file test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/Dockerfile

ARG SDK_VERSION=7.0
FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS build
ARG BUILD_SDK_VERSION=7.0
ARG TEST_SDK_VERSION=7.0

FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build
ARG PUBLISH_CONFIGURATION=Release
ARG PUBLISH_FRAMEWORK=net7.0
WORKDIR /repo
COPY . ./
WORKDIR "/repo/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests"
RUN dotnet publish "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}

FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final
FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final
WORKDIR /test
COPY --from=build /drop .
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests.dll", "--logger:console;verbosity=detailed"]
10 changes: 6 additions & 4 deletions test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# This should be run from the root of the repo:
# docker build --file test/OpenTelemetry.Instrumentation.SqlClient.Tests/Dockerfile .

ARG SDK_VERSION=7.0
FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS build
ARG BUILD_SDK_VERSION=7.0
ARG TEST_SDK_VERSION=7.0

FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build
ARG PUBLISH_CONFIGURATION=Release
ARG PUBLISH_FRAMEWORK=net7.0
WORKDIR /repo
Expand All @@ -12,9 +14,9 @@ RUN ls -la /repo
WORKDIR "/repo/test/OpenTelemetry.Instrumentation.SqlClient.Tests"
RUN dotnet publish "OpenTelemetry.Instrumentation.SqlClient.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}

FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final
FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.7.3/wait /wait
RUN chmod +x /wait
WORKDIR /test
COPY --from=build /drop .
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll"]
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.SqlClient.Tests.dll", "--logger:console;verbosity=detailed"]
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
# This should be run from the root of the repo:
# docker build --file test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/Dockerfile .

ARG SDK_VERSION=7.0
ARG BUILD_SDK_VERSION=7.0
ARG TEST_SDK_VERSION=7.0

FROM ubuntu AS w3c
#Install git
WORKDIR /w3c
RUN apt-get update && apt-get install -y git
RUN git clone https://github.com/w3c/trace-context.git

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:${BUILD_SDK_VERSION} AS build
ARG PUBLISH_CONFIGURATION=Release
ARG PUBLISH_FRAMEWORK=net7.0
WORKDIR /repo
COPY . ./
WORKDIR "/repo/test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests"
RUN dotnet publish "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.csproj" -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /drop -p:IntegrationBuild=true -p:TARGET_FRAMEWORK=${PUBLISH_FRAMEWORK}

FROM mcr.microsoft.com/dotnet/sdk:${SDK_VERSION} AS final
FROM mcr.microsoft.com/dotnet/sdk:${TEST_SDK_VERSION} AS final
WORKDIR /test
COPY --from=build /drop .
COPY --from=w3c /w3c .
Expand All @@ -27,4 +29,4 @@ RUN apt-get update \
&& ln -s /usr/bin/python3 python \
&& pip3 install --upgrade pip \
&& pip3 install aiohttp
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.dll"]
ENTRYPOINT ["dotnet", "vstest", "OpenTelemetry.Instrumentation.W3cTraceContext.Tests.dll", "--logger:console;verbosity=detailed"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System.Diagnostics;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
Expand All @@ -34,6 +34,7 @@ public class W3CTraceContextTests
opentelemetry>docker-compose --file=test/OpenTelemetry.Instrumentation.W3cTraceContext.Tests/docker-compose.yml --project-directory=. up --exit-code-from=tests --build
*/
private const string W3cTraceContextEnvVarName = "OTEL_W3CTRACECONTEXT";
private static readonly Version AspNetCoreHostingVersion = typeof(Microsoft.AspNetCore.Hosting.Builder.IApplicationBuilderFactory).Assembly.GetName().Version;
private readonly HttpClient httpClient = new HttpClient();
private readonly ITestOutputHelper output;

Expand All @@ -59,7 +60,7 @@ public void W3CTraceContextTestSuiteAsync(string value)
// disabling due to failing dotnet-format
// TODO: investigate why dotnet-format fails.
#pragma warning disable SA1008 // Opening parenthesis should be spaced correctly
app.MapPost("/", async([FromBody]Data[] data) =>
app.MapPost("/", async([FromBody] Data[] data) =>
{
var result = string.Empty;
if (data != null)
Expand Down Expand Up @@ -90,13 +91,24 @@ public void W3CTraceContextTestSuiteAsync(string value)
string result = RunCommand("python", "trace-context/test/test.py http://localhost:5000/");

// Assert
string lastLine = ParseLastLine(result);

this.output.WriteLine("result:" + result);

// Assert on the last line

// TODO: Investigate failures:
// 1) harness sends a request with an invalid tracestate header with duplicated keys ... FAIL
// 2) harness sends an invalid traceparent with illegal characters in trace_flags ... FAIL
string lastLine = ParseLastLine(result);
this.output.WriteLine("result:" + result);
Assert.StartsWith("FAILED (failures=3)", lastLine);

if (AspNetCoreHostingVersion.Major <= 6)
{
Assert.StartsWith("FAILED (failures=5)", lastLine);
utpilla marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Assert.StartsWith("FAILED (failures=3)", lastLine);
}
}

private static string RunCommand(string command, string args)
Expand Down