Skip to content

Commit

Permalink
Project files: cleanup/normalization (#641)
Browse files Browse the repository at this point in the history
General project file cleanup and normalization. Also adding GitHub Actions enhanced logging for test results.
  • Loading branch information
NickCraver committed Aug 2, 2023
1 parent 39bf8c8 commit b53cf08
Show file tree
Hide file tree
Showing 60 changed files with 340 additions and 219 deletions.
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,9 @@ dotnet_diagnostic.IDE0079.severity = none
dotnet_diagnostic.IDE0090.severity = silent

# CA1822: Don't run for benchmarks and such
dotnet_code_quality.CA1822.api_surface = private, internal
dotnet_code_quality.CA1822.api_surface = private, internal

# IDE0056: Use index operator
csharp_style_prefer_index_operator = false
# IDE0057: Use range operator
csharp_style_prefer_range_operator = false
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: .NET Build
run: dotnet build Build.csproj -c Release /p:CI=true
- name: .NET Test
run: dotnet test Build.csproj -c Release --no-build /p:CI=true
run: dotnet test Build.csproj -c Release --no-build --logger trx --logger GitHubActions --results-directory ./test-results/ /p:CI=true
env:
EnableTestLogging: true
RedisConnectionString: localhost:${{ job.services.redis.ports[6379] }}
Expand All @@ -72,5 +72,13 @@ jobs:
RavenDbUrls: http://localhost:${{ job.services.ravendb.ports[8080] }}
RavenDatabase: test
SQLServerConnectionString: Server=tcp:127.0.0.1,${{ job.services.sqlserver.ports[1433] }};Database=tempdb;User Id=sa;Password=g0d4mm!tSQLServer;
- name: .NET Test Results
uses: dorny/test-reporter@v1
continue-on-error: true
if: success() || failure()
with:
name: .NET Test Results
path: 'test-results/*.trx'
reporter: dotnet-trx
- name: .NET Lib Pack
run: dotnet pack Build.csproj --no-build -c Release /p:PackageOutputPath=%CD%\.nupkgs /p:CI=true
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472, invocationCount: 50_000)]
[SimpleJob(RuntimeMoniker.Net50, invocationCount: 50_000)]
[SimpleJob(RuntimeMoniker.Net60, invocationCount: 50_000)]
[Config(typeof(Configs.Memory))]
public class CustomTimingBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Benchmarks.Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[SimpleJob(RuntimeMoniker.Net60)]
[Config(typeof(Configs.Memory))]
public class DictionaryBenchmarks
{
Expand Down
44 changes: 22 additions & 22 deletions benchmarks/MiniProfiler.Benchmarks/Benchmarks/JSONLibBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[SimpleJob(RuntimeMoniker.Net60)]
[Config(typeof(Configs.Memory))]
public class JSONLibBenchmarks
{
Expand All @@ -29,38 +29,38 @@ static JSONLibBenchmarks()

[Benchmark(Description = "Serialize: Simple MiniProfiler (Newtonsoft)")]
public string SimpleSerializeNewtonsoft() => JsonConvert.SerializeObject(_simpleProfiler);

[Benchmark(Description = "Serialize: Simple MiniProfiler (Jil)")]
public string SimpleSerializeJil() => JSON.Serialize(_simpleProfiler, JilOptions);

[Benchmark(Description = "Serialize: Simple MiniProfiler (ServiceStack)")]
public string SimpleSerializeServiceStack() => ServiceStack.Text.JsonSerializer.SerializeToString(_simpleProfiler);

[Benchmark(Description = "Serialize: Complex MiniProfiler (Newtonsoft)")]
public string ComplexSerializeNewtonsoft() => JsonConvert.SerializeObject(_complexProfiler);

[Benchmark(Description = "Serialize: Complex MiniProfiler (Jil)")]
public string ComplexSerializeJil() => JSON.Serialize(_complexProfiler, JilOptions);

[Benchmark(Description = "Serialize: Complex MiniProfiler (ServiceStack)")]
public string ComplexSerializeServiceStack() => ServiceStack.Text.JsonSerializer.SerializeToString(_complexProfiler);

[Benchmark(Description = "Deserialize: Simple MiniProfiler (Newtonsoft)")]
public MiniProfiler? SimpleDeserializeNewtonsoft() => JsonConvert.DeserializeObject<MiniProfiler>(_simpleProfilerJson);

[Benchmark(Description = "Deserialize: Simple MiniProfiler (Jil)")]
public MiniProfiler SimpleDeserializeBuiltIn() => JSON.Deserialize<MiniProfiler>(_simpleProfilerJson, JilOptions);

[Benchmark(Description = "Deserialize: Simple MiniProfiler (ServiceStack)")]
public MiniProfiler SimpleDeserializeServiceStack() => ServiceStack.Text.JsonSerializer.DeserializeFromString<MiniProfiler>(_simpleProfilerJson);

[Benchmark(Description = "Deserialize: Complex MiniProfiler (Newtonsoft)")]
public MiniProfiler? ComplexDeserializeNewtonsoft() => JsonConvert.DeserializeObject<MiniProfiler>(_complexProfilerJson);

[Benchmark(Description = "Serialize: Simple MiniProfiler (Jil)")]
public string SimpleSerializeJil() => JSON.Serialize(_simpleProfiler, JilOptions);
[Benchmark(Description = "Serialize: Complex MiniProfiler (Jil)")]
public string ComplexSerializeJil() => JSON.Serialize(_complexProfiler, JilOptions);
[Benchmark(Description = "Deserialize: Simple MiniProfiler (Jil)")]
public MiniProfiler SimpleDeserializeBuiltIn() => JSON.Deserialize<MiniProfiler>(_simpleProfilerJson, JilOptions);
[Benchmark(Description = "Deserialize: Complex MiniProfiler (Jil)")]
public MiniProfiler ComplexDeserializeBuiltIn() => JSON.Deserialize<MiniProfiler>(_complexProfilerJson, JilOptions);

[Benchmark(Description = "Serialize: Simple MiniProfiler (ServiceStack)")]
public string SimpleSerializeServiceStack() => ServiceStack.Text.JsonSerializer.SerializeToString(_simpleProfiler);
[Benchmark(Description = "Serialize: Complex MiniProfiler (ServiceStack)")]
public string ComplexSerializeServiceStack() => ServiceStack.Text.JsonSerializer.SerializeToString(_complexProfiler);
[Benchmark(Description = "Deserialize: Simple MiniProfiler (ServiceStack)")]
public MiniProfiler SimpleDeserializeServiceStack() => ServiceStack.Text.JsonSerializer.DeserializeFromString<MiniProfiler>(_simpleProfilerJson);
[Benchmark(Description = "Deserialize: Complex MiniProfiler (ServiceStack)")]
public MiniProfiler ComplexDeserializeServiceStack() => ServiceStack.Text.JsonSerializer.DeserializeFromString<MiniProfiler>(_complexProfilerJson);

[Benchmark(Description = "Serialize: Simple MiniProfiler (System.Text.Json)")]
public string SimpleSerializeSystemTextJson() => System.Text.Json.JsonSerializer.Serialize(_simpleProfiler);
[Benchmark(Description = "Serialize: Complex MiniProfiler (System.Text.Json)")]
public string ComplexSerializeSystemTextJson() => System.Text.Json.JsonSerializer.Serialize(_complexProfiler);
[Benchmark(Description = "Deserialize: Simple MiniProfiler (System.Text.Json)")]
public MiniProfiler? SimpleDeserializeSystemTextJson() => System.Text.Json.JsonSerializer.Deserialize<MiniProfiler>(_simpleProfilerJson);
[Benchmark(Description = "Deserialize: Complex MiniProfiler (System.Text.Json)")]
public MiniProfiler? ComplexDeserializeSystemTextJson() => System.Text.Json.JsonSerializer.Deserialize<MiniProfiler>(_complexProfilerJson);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[SimpleJob(RuntimeMoniker.Net60)]
[Config(typeof(Configs.Memory))]
public class MiniProfilerBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[SimpleJob(RuntimeMoniker.Net60)]
[Config(typeof(Configs.Memory))]
public class SerializationBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Benchmarks
{
[SimpleJob(RuntimeMoniker.Net472)]
[SimpleJob(RuntimeMoniker.Net50)]
[SimpleJob(RuntimeMoniker.Net60)]
[Config(typeof(Configs.Full))]
public class StackTraceSnippetBenchmarks
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,20 @@
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<PlatformTarget>AnyCPU</PlatformTarget>
<SignAssembly>false</SignAssembly>
<LangVersion>9</LangVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.4" />
<PackageReference Include="Jil" Version="2.16" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="ServiceStack.Text" Version="6.6.0" />
<PackageReference Include="System.Ben" Version="1.0.0" />
</ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.1" />

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="ServiceStack.Text.Core" Version="5.12.0" />
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="ServiceStack.Text" Version="5.12.0" />
<Reference Include="System.Web.Extensions" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/Misc/Misc.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
</ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions samples/Samples.AspNet/Samples.AspNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<TargetFramework>net6.0</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.MiddlewareAnalysis" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.13" />

<ProjectReference Include="..\..\src\MiniProfiler.AspNetCore.Mvc\MiniProfiler.AspNetCore.Mvc.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.EntityFrameworkCore\MiniProfiler.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.Sqlite\MiniProfiler.Providers.Sqlite.csproj" />
<PackageReference Include="Microsoft.AspNetCore.MiddlewareAnalysis" Version="6.0.13" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.13" />
</ItemGroup>
</Project>
16 changes: 10 additions & 6 deletions samples/Samples.Console/Samples.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
<OutputPath>bin\$(Configuration)\</OutputPath>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
<PackageReference Include="System.Data.SQLite" Version="1.0.105.2" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />

<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
<PackageReference Include="System.Data.SQLite" Version="1.0.105.2" />

<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="App.config" />
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion samples/Samples.ConsoleCore/Samples.ConsoleCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<AssemblyName>Samples.Console</AssemblyName>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.AspNetCore\MiniProfiler.AspNetCore.csproj" />
<PackageReference Include="Dapper.StrongName" Version="1.50.2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="2.0.0" />

<ProjectReference Include="..\..\src\MiniProfiler.AspNetCore\MiniProfiler.AspNetCore.csproj" />
</ItemGroup>
</Project>
43 changes: 13 additions & 30 deletions samples/Samples.Mvc5.EFCore/Samples.Mvc5.EFCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,36 @@
<UseIISExpress>true</UseIISExpress>
<OutputPath>bin\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PostBuildEvent>
if not exist "roslyn" md "roslyn"
xcopy /s /y /q "$(CscToolPath)\*.*" "roslyn"
</PostBuildEvent>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.EntityFrameworkCore\MiniProfiler.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Mvc5\MiniProfiler.Mvc5.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />

<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageReference Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="1.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SQLite" Version="2.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml" />

<ProjectReference Include="..\..\src\MiniProfiler.EntityFrameworkCore\MiniProfiler.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Mvc5\MiniProfiler.Mvc5.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="Content\**\*" />
<Content Include="Scripts\**\*" />
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
</ItemGroup>

<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>

<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
Expand Down
43 changes: 13 additions & 30 deletions samples/Samples.Mvc5/Samples.Mvc5.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,24 @@
<UseIISExpress>true</UseIISExpress>
<OutputPath>bin\</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PostBuildEvent>
if not exist "roslyn" md "roslyn"
xcopy /s /y /q "$(CscToolPath)\*.*" "roslyn"
</PostBuildEvent>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MiniProfiler.EF6\MiniProfiler.EF6.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Mvc5\MiniProfiler.Mvc5.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />

<PackageReference Include="EntityFramework.SqlServerCompact" Version="6.1.3" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.3" />
<PackageReference Include="Microsoft.AspNet.Web.Optimization" Version="1.1.3" />
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="1.0.8" />
<PackageReference Include="System.Data.SQLite" Version="1.0.105.2" />
<PackageReference Include="System.Data.SQLite.EF6" Version="1.0.105.2" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml" />

<ProjectReference Include="..\..\src\MiniProfiler.EF6\MiniProfiler.EF6.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Mvc5\MiniProfiler.Mvc5.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Providers.SqlServer\MiniProfiler.Providers.SqlServer.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler.Shared\MiniProfiler.Shared.csproj" />
<ProjectReference Include="..\..\src\MiniProfiler\MiniProfiler.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="_bin_deployableAssemblies\**\*" />
Expand All @@ -57,9 +37,11 @@
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
</ItemGroup>

<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>

<PropertyGroup>
<PostBuildEvent>
if not exist "$(TargetDir)x86" md "$(TargetDir)x86"
Expand All @@ -69,6 +51,7 @@
xcopy /s /y /q "$(NuGetPackageRoot)\sqlite\3.13.0\runtimes\win7-x64\native\*.*" "$(TargetDir)x64\.."
</PostBuildEvent>
</PropertyGroup>

<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
Expand Down
Loading

0 comments on commit b53cf08

Please sign in to comment.