浏览代码

Add Wired.IO framework (#10022)

* Add Wired.IO

* fix plain text header

* fix json and plaintext responses

* Fix plaintext response

* Fix runtime identifier

* Add missing headers
Diogo Martins 3 周之前
父节点
当前提交
d973e2b334

+ 38 - 0
frameworks/CSharp/wiredio/.gitignore

@@ -0,0 +1,38 @@
+[Oo]bj/
+[Bb]in/
+TestResults/
+.nuget/
+*.sln
+*.sln.ide/
+_ReSharper.*/
+.idea/
+packages/
+artifacts/
+PublishProfiles/
+.vs/
+*.user
+*.suo
+*.cache
+*.docstates
+_ReSharper.*
+nuget.exe
+*net45.csproj
+*net451.csproj
+*k10.csproj
+*.psess
+*.vsp
+*.pidb
+*.userprefs
+*DS_Store
+*.ncrunchsolution
+*.*sdf
+*.ipch
+*.swp
+*~
+.build/
+.testPublish/
+launchSettings.json
+BenchmarkDotNet.Artifacts/
+BDN.Generated/
+binaries/
+global.json

+ 23 - 0
frameworks/CSharp/wiredio/Benchmarks/Benchmarks.csproj

@@ -0,0 +1,23 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>net9.0</TargetFramework>
+    <LangVersion>13.0</LangVersion>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+
+    <ServerGarbageCollection>true</ServerGarbageCollection>
+    <TieredPGO>true</TieredPGO>
+
+    <!-- Required for self-contained publish -->
+    <RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
+    <SelfContained>true</SelfContained>
+    
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Wired.IO" Version="9.2.0" />
+  </ItemGroup>
+
+</Project>

+ 32 - 0
frameworks/CSharp/wiredio/Benchmarks/Program.cs

@@ -0,0 +1,32 @@
+using System.Net;
+using System.Text.Json;
+using Wired.IO.App;
+using Wired.IO.Http11.Response.Content;
+using Wired.IO.Protocol.Response;
+using StringContent = Wired.IO.Http11.Response.Content.StringContent;
+
+var builder = WiredApp.CreateBuilder();
+
+await builder
+    .Endpoint(IPAddress.Any, 8080)
+    .MapGet("/plaintext", scope => context =>
+    {
+        context
+            .Respond()
+            .Status(ResponseStatus.Ok)
+            .Content(new StringContent("Hello, World!"))
+            .Type("text/plain");
+    })
+    .MapGet("/json", scope => context =>
+    {
+        context
+            .Respond()
+            .Status(ResponseStatus.Ok)
+            .Content(new JsonContent(new
+            {
+                Message = "Hello, World!"
+            }, JsonSerializerOptions.Default))
+            .Type("application/json");
+    })
+    .Build()
+    .RunAsync();

+ 22 - 0
frameworks/CSharp/wiredio/README.md

@@ -0,0 +1,22 @@
+# Wired.IO Tests on Linux
+
+See the [Wired.IO Documentation](https://mda2av.github.io/Wired.IO.Docs/) for more information.
+
+## Infrastructure Software Versions
+
+**Language**
+
+* C# 13.0
+
+**Platforms**
+
+* .NET 8/9
+
+**Web Servers**
+
+* [Wired.IO](https://github.com/MDA2AV/Wired.IO)
+
+## Paths & Source for Tests
+
+* [Plaintext](Benchmarks/Program.cs): "/plaintext"
+* [JSON](Benchmarks/Program.cs): "/json"

+ 24 - 0
frameworks/CSharp/wiredio/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+  "framework": "wiredio",
+  "tests": [
+    {
+      "default": {
+        "plaintext_url": "/plaintext",
+        "json_url": "/json",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Fullstack",
+        "database": "None",
+        "framework": "Wired.IO",
+        "language": "C#",
+        "orm": "None",
+        "platform": ".NET",
+        "webserver": "Wired.IO",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "Wired.IO",
+        "notes": "Only plaintext and JSON benchmarks implemented"
+      }
+    }
+  ]
+}

+ 14 - 0
frameworks/CSharp/wiredio/config.toml

@@ -0,0 +1,14 @@
+[framework]
+name = "wiredio"
+
+[main]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Realistic"
+classification = "Fullstack"
+os = "Linux"
+database_os = "Linux"
+orm = "None"
+platform = ".NET"
+webserver = "Wired.IO"
+versus = "None"

+ 24 - 0
frameworks/CSharp/wiredio/wiredio.dockerfile

@@ -0,0 +1,24 @@
+FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
+WORKDIR /source
+
+# copy csproj and restore as distinct layers
+COPY Benchmarks/*.csproj .
+RUN dotnet restore -r linux-musl-x64
+
+# copy and publish app and libraries
+COPY Benchmarks/ .
+RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
+
+# final stage/image
+FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
+
+ENV DOTNET_GCDynamicAdaptationMode=0
+ENV DOTNET_ReadyToRun=0
+ENV DOTNET_HillClimbing_Disable=1
+
+WORKDIR /app
+COPY --from=build /app .
+
+ENTRYPOINT ["./Benchmarks"]
+
+EXPOSE 8080