Skip to content

Commit

Permalink
handle Centos tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek committed Oct 16, 2023
1 parent 679ea21 commit 2448276
Show file tree
Hide file tree
Showing 22 changed files with 57 additions and 25 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
include:
- base-image: alpine
os-type: linux-musl
net-version: net8.0
runs-on: ubuntu-20.04
timeout-minutes: 60
steps:
Expand All @@ -34,10 +33,10 @@ jobs:
docker build -t mybuildimage -f "./docker/${{ matrix.base-image }}.dockerfile" ./docker
docker run --mount type=bind,source="${GITHUB_WORKSPACE}",target=/project --rm mybuildimage /bin/sh -c '
set -e
dotnet publish -f ${{ matrix.net-version }} -c Release ./test/test-applications/integrations/TestApplication.Smoke
dotnet publish -f net8.0 -c Release ./test/test-applications/integrations/TestApplication.Smoke
export OTEL_DOTNET_AUTO_HOME="${PWD}/bin/tracer-home"
. ./instrument.sh
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/${{ matrix.net-version }}/publish/TestApplication.Smoke
./test/test-applications/integrations/bin/TestApplication.Smoke/Release/net8.0/publish/TestApplication.Smoke
test "$(ls -A /var/log/opentelemetry/dotnet )"
'
- name: Publish Linux build
Expand Down
5 changes: 3 additions & 2 deletions build/Build.NuGet.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,16 @@ partial class Build
string MapToNet8RuntimeIdentifiers(string oldRuntimeIdentifier)
{
#if NET8_0_OR_GREATER
// #error Remove method when _build.cproj starts targeting .NET8+
#endif
return oldRuntimeIdentifier;
#else
switch (oldRuntimeIdentifier)
{
case "ubuntu.20.04-x64": return "linux-x64";
case "osx.11.0-x64": return "osx-x64";
case "win10-x64": return "win-x64";
}
throw new NotSupportedException($"{oldRuntimeIdentifier} is not supported. Extend MapToNet8RuntimeIdentifiers.");
#endif
}

foreach (var packagesTestApplicationProject in Solution.GetNuGetPackagesTestApplications())
Expand Down
6 changes: 5 additions & 1 deletion build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ partial class Build
};

private static readonly IEnumerable<TargetFramework> TestFrameworks = TargetFrameworks
.Concat(TargetFramework.NET7_0, TargetFramework.NET8_0);
.Concat(TargetFramework.NET7_0
#if NET8_0_OR_GREATER
, TargetFramework.NET8_0
#endif
);

Target CreateRequiredDirectories => _ => _
.Unlisted()
Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework Condition=" '!$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">net8.0</TargetFramework>
<TargetFramework Condition=" '$(IsCentos)' == '' ">net8.0</TargetFramework>
<TargetFramework Condition=" '$(IsCentos)' != '' ">net7.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..\</NukeRootDirectory>
Expand Down
1 change: 1 addition & 0 deletions docker/centos.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM ghcr.io/open-telemetry/opentelemetry-dotnet-instrumentation-centos7-build-i
RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
RUN yum -y install dotnet-sdk-6.0-6.0.415-1 dotnet-sdk-7.0-7.0.402-1

ENV IsCentos=true
WORKDIR /project
COPY ./docker-entrypoint.sh /
ENTRYPOINT ["/docker-entrypoint.sh"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<RootNamespace>Examples.AspNetCoreMvc</RootNamespace>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<PropertyGroup>
<DefineConstants Condition="'$(BuildingInsideVisualStudio)'=='true'">$(DefineConstants);DEFAULT_TEST_PACKAGE_VERSIONS</DefineConstants>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>

<!-- Hide warnings for EOL .NET Core targets (e.g. netcoreapp3.0) -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion test/test-applications/integrations/Integrations.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>

<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
<DefineConstants Condition="'$(LibraryVersion)'=='' or '$(LibraryVersion)'>='3.7.0'">$(DefineConstants);QUARTZ_3_7_0_OR_GREATER</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"TestApplication.Razor": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:53389;http://localhost:53390"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion test/test-applications/nuget-packages/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks Condition=" '$(IsCentos)' == '' ">net8.0;$(TargetFrameworks)</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>

<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions tools/DependencyListGenerator/DependencyListGenerator.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework Condition=" '!$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">net7.0</TargetFramework>
<TargetFramework Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">net8.0</TargetFramework>
<TargetFramework Condition=" '$(IsCentos)' == '' ">net8.0</TargetFramework>
<TargetFramework Condition=" '$(IsCentos)' != '' ">net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>
Expand Down

0 comments on commit 2448276

Please sign in to comment.