Skip to content

Commit d973e2b

Browse files
authored
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
1 parent 357165c commit d973e2b

File tree

7 files changed

+177
-0
lines changed

7 files changed

+177
-0
lines changed

frameworks/CSharp/wiredio/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[Oo]bj/
2+
[Bb]in/
3+
TestResults/
4+
.nuget/
5+
*.sln
6+
*.sln.ide/
7+
_ReSharper.*/
8+
.idea/
9+
packages/
10+
artifacts/
11+
PublishProfiles/
12+
.vs/
13+
*.user
14+
*.suo
15+
*.cache
16+
*.docstates
17+
_ReSharper.*
18+
nuget.exe
19+
*net45.csproj
20+
*net451.csproj
21+
*k10.csproj
22+
*.psess
23+
*.vsp
24+
*.pidb
25+
*.userprefs
26+
*DS_Store
27+
*.ncrunchsolution
28+
*.*sdf
29+
*.ipch
30+
*.swp
31+
*~
32+
.build/
33+
.testPublish/
34+
launchSettings.json
35+
BenchmarkDotNet.Artifacts/
36+
BDN.Generated/
37+
binaries/
38+
global.json
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<LangVersion>13.0</LangVersion>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
10+
<ServerGarbageCollection>true</ServerGarbageCollection>
11+
<TieredPGO>true</TieredPGO>
12+
13+
<!-- Required for self-contained publish -->
14+
<RuntimeIdentifier>linux-musl-x64</RuntimeIdentifier>
15+
<SelfContained>true</SelfContained>
16+
17+
</PropertyGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Wired.IO" Version="9.2.0" />
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System.Net;
2+
using System.Text.Json;
3+
using Wired.IO.App;
4+
using Wired.IO.Http11.Response.Content;
5+
using Wired.IO.Protocol.Response;
6+
using StringContent = Wired.IO.Http11.Response.Content.StringContent;
7+
8+
var builder = WiredApp.CreateBuilder();
9+
10+
await builder
11+
.Endpoint(IPAddress.Any, 8080)
12+
.MapGet("/plaintext", scope => context =>
13+
{
14+
context
15+
.Respond()
16+
.Status(ResponseStatus.Ok)
17+
.Content(new StringContent("Hello, World!"))
18+
.Type("text/plain");
19+
})
20+
.MapGet("/json", scope => context =>
21+
{
22+
context
23+
.Respond()
24+
.Status(ResponseStatus.Ok)
25+
.Content(new JsonContent(new
26+
{
27+
Message = "Hello, World!"
28+
}, JsonSerializerOptions.Default))
29+
.Type("application/json");
30+
})
31+
.Build()
32+
.RunAsync();

frameworks/CSharp/wiredio/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Wired.IO Tests on Linux
2+
3+
See the [Wired.IO Documentation](https://mda2av.github.io/Wired.IO.Docs/) for more information.
4+
5+
## Infrastructure Software Versions
6+
7+
**Language**
8+
9+
* C# 13.0
10+
11+
**Platforms**
12+
13+
* .NET 8/9
14+
15+
**Web Servers**
16+
17+
* [Wired.IO](https://github.com/MDA2AV/Wired.IO)
18+
19+
## Paths & Source for Tests
20+
21+
* [Plaintext](Benchmarks/Program.cs): "/plaintext"
22+
* [JSON](Benchmarks/Program.cs): "/json"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"framework": "wiredio",
3+
"tests": [
4+
{
5+
"default": {
6+
"plaintext_url": "/plaintext",
7+
"json_url": "/json",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Fullstack",
11+
"database": "None",
12+
"framework": "Wired.IO",
13+
"language": "C#",
14+
"orm": "None",
15+
"platform": ".NET",
16+
"webserver": "Wired.IO",
17+
"os": "Linux",
18+
"database_os": "Linux",
19+
"display_name": "Wired.IO",
20+
"notes": "Only plaintext and JSON benchmarks implemented"
21+
}
22+
}
23+
]
24+
}

frameworks/CSharp/wiredio/config.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[framework]
2+
name = "wiredio"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Fullstack"
9+
os = "Linux"
10+
database_os = "Linux"
11+
orm = "None"
12+
platform = ".NET"
13+
webserver = "Wired.IO"
14+
versus = "None"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
2+
WORKDIR /source
3+
4+
# copy csproj and restore as distinct layers
5+
COPY Benchmarks/*.csproj .
6+
RUN dotnet restore -r linux-musl-x64
7+
8+
# copy and publish app and libraries
9+
COPY Benchmarks/ .
10+
RUN dotnet publish -c release -o /app -r linux-musl-x64 --no-restore --self-contained
11+
12+
# final stage/image
13+
FROM mcr.microsoft.com/dotnet/runtime-deps:9.0-alpine
14+
15+
ENV DOTNET_GCDynamicAdaptationMode=0
16+
ENV DOTNET_ReadyToRun=0
17+
ENV DOTNET_HillClimbing_Disable=1
18+
19+
WORKDIR /app
20+
COPY --from=build /app .
21+
22+
ENTRYPOINT ["./Benchmarks"]
23+
24+
EXPOSE 8080

0 commit comments

Comments
 (0)