Skip to content

Commit 5c9f2c3

Browse files
Merge branch 'main' into feature/sync-responses
2 parents 058cd70 + c2b7f94 commit 5c9f2c3

File tree

9 files changed

+187
-65
lines changed

9 files changed

+187
-65
lines changed

.github/workflows/build.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
9+
build:
10+
11+
name: Test & Coverage
12+
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
18+
DOTNET_ROLL_FORWARD: Major
19+
20+
steps:
21+
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Install msquic
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y libmsquic
31+
32+
- name: Download .NET SDK
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: 9.0
36+
37+
- name: Restore tools
38+
run: dotnet tool restore
39+
40+
- name: Begin scan
41+
if: env.SONAR_TOKEN != null && env.SONAR_TOKEN != ''
42+
run: dotnet sonarscanner begin /k:"GenHTTP" /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.exclusions="**/bin/**/*,**/obj/**/*,**/Playground/**/*,**/*.css,**/*.js,**/*.html" /o:"kaliumhexacyanoferrat" /k:"GenHTTP" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.branch.name="${GITHUB_REF##*/}" /d:sonar.dotnet.excludeTestProjects=true
43+
44+
- name: Build project
45+
run: dotnet build GenHTTP.slnx -c Release
46+
47+
- name: Test project
48+
run: dotnet test GenHTTP.slnx --no-build --collect:"XPlat Code Coverage" -c Release -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
49+
50+
- name: End scan
51+
if: env.SONAR_TOKEN != null && env.SONAR_TOKEN != ''
52+
run: dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"
53+
54+
verify:
55+
56+
name: ${{ matrix.os.name }} ${{ matrix.arch }}
57+
58+
needs: build
59+
60+
runs-on: ${{ matrix.os.runs-on }}
61+
62+
env:
63+
TEST_ENGINE: Internal
64+
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
include:
69+
70+
- os:
71+
name: 🐧
72+
runs-on: ubuntu-latest
73+
arch: x64
74+
runtime: linux-x64
75+
platform: linux/amd64
76+
77+
- os:
78+
name: 🐧
79+
runs-on: linux-arm32
80+
arch: arm32
81+
runtime: linux-arm
82+
platform: linux/arm/v7
83+
84+
- os:
85+
name: 🐧
86+
runs-on: ubuntu-22.04-arm
87+
arch: arm64
88+
runtime: linux-arm64
89+
platform: linux/arm64/v8
90+
91+
- os:
92+
name: 🪟
93+
runs-on: windows-latest
94+
arch: x64
95+
runtime: win-x64
96+
platform: windows/amd64
97+
98+
- os:
99+
name: 🪟
100+
runs-on: windows-latest
101+
arch: arm64
102+
runtime: win-arm64
103+
platform: windows/arm64
104+
105+
- os:
106+
name: 🍎
107+
runs-on: macos-15-intel
108+
arch: x64
109+
runtime: osx-x64
110+
platform: macos/amd64
111+
112+
- os:
113+
name: 🍎
114+
runs-on: macos-15
115+
arch: arm64
116+
runtime: osx-arm64
117+
platform: macos/arm64
118+
119+
steps:
120+
- name: Checkout source
121+
uses: actions/checkout@v4
122+
123+
- name: Setup .NET SDK
124+
uses: actions/setup-dotnet@v4
125+
if: matrix.os.runs-on != 'linux-arm32'
126+
with:
127+
dotnet-version: |
128+
8.0
129+
9.0
130+
131+
- name: Build & Test (${{ matrix.runtime }})
132+
run: dotnet test Testing/Acceptance/GenHTTP.Testing.Acceptance.csproj -c Release

.github/workflows/ci.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GenHTTP is a lightweight web server written in pure C# with a strong focus on de
44
purpose of this project is to quickly create web services written in .NET 8 / 9, allowing developers to concentrate on
55
the functionality rather than on messing around with configuration files or complex concepts.
66

7-
[![CI](https://github.com/Kaliumhexacyanoferrat/GenHTTP/actions/workflows/ci.yml/badge.svg)](https://github.com/Kaliumhexacyanoferrat/GenHTTP/actions/workflows/ci.yml) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GenHTTP&metric=coverage)](https://sonarcloud.io/dashboard?id=GenHTTP) [![nuget Package](https://img.shields.io/nuget/v/GenHTTP.Core.svg)](https://www.nuget.org/packages/GenHTTP.Core/) [](https://discord.gg/cW6tPJS7nt) [![Discord](https://discordapp.com/api/guilds/1177529388229734410/widget.png?style=shield)](https://discord.gg/GwtDyUpkpV)
7+
[![View - Documentation](https://img.shields.io/badge/view-Documentation-AB54FF)](https://genhttp.org/documentation/) [![nuget Package](https://img.shields.io/nuget/v/GenHTTP.Core.svg)](https://www.nuget.org/packages/GenHTTP.Core/) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GenHTTP&metric=coverage)](https://sonarcloud.io/dashboard?id=GenHTTP) [![Discord](https://discordapp.com/api/guilds/1177529388229734410/widget.png?style=shield)](https://discord.gg/GwtDyUpkpV)
88

99
## 🚀 Features
1010

@@ -16,6 +16,18 @@ the functionality rather than on messing around with configuration files or comp
1616
- [Optimized](https://genhttp.org/features/) out of the box, small memory and storage [footprint](https://genhttp.org/features/#footprint)
1717
- Grade A+ security level according to SSL Labs
1818

19+
## 💻 Supported Platforms
20+
21+
GenHTTP targets all .NET versions currently [supported by Microsoft](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core).
22+
Major versions are released once a year, following the .NET release cycle.
23+
Additionally, our automated tests ensure full compatibility on the following platforms:
24+
25+
| OS | Architectures |
26+
|---------|-------------------------|
27+
| Linux | `x64`, `arm32`, `arm64` |
28+
| Windows | `x64`, `arm64` |
29+
| macOS | `x64`, `arm64` |
30+
1931
## 📖 Getting Started
2032

2133
This section shows how to create a new project from scratch using project templates and how to extend your existing
@@ -123,9 +135,3 @@ in C#. In 2024 the focus has shifted towards API development, dropping support f
123135

124136
- Powered by [.NET](https://github.com/dotnet/core)
125137
- Modules implemented with [NSwag](https://github.com/RicoSuter/NSwag) (Open API), [Fleck](https://github.com/statianzo/Fleck) (WebSockets)
126-
127-
## 👥 Contributors
128-
129-
<a href="https://github.com/Kaliumhexacyanoferrat/GenHTTP/graphs/contributors">
130-
<img src="https://contrib.rocks/image?repo=Kaliumhexacyanoferrat/GenHTTP" />
131-
</a>

Testing/Acceptance/Engine/Kestrel/CustomizingTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace GenHTTP.Testing.Acceptance.Engine.Kestrel;
66

77
[TestClass]
8-
public class CustomizingTests
8+
public class CustomizingTests : KestrelBaseTest
99
{
1010

1111
[TestMethod]
1212
public async Task TestHooks()
1313
{
14+
if (!CheckKestrel()) return;
15+
1416
var configHook = (WebApplicationBuilder b) => { };
1517

1618
var appHook = (WebApplication a) => { };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace GenHTTP.Testing.Acceptance.Engine.Kestrel;
2+
3+
public class KestrelBaseTest
4+
{
5+
6+
protected bool CheckKestrel() => Environment.GetEnvironmentVariable("TEST_ENGINE") == null;
7+
8+
}

Testing/Acceptance/Engine/Kestrel/LifecycleTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
namespace GenHTTP.Testing.Acceptance.Engine.Kestrel;
55

66
[TestClass]
7-
public class LifecycleTests
7+
public class LifecycleTests : KestrelBaseTest
88
{
99

1010
[TestMethod]
1111
public async Task TestLifecycle()
1212
{
13+
if (!CheckKestrel()) return;
14+
1315
var handler = Content.From(Resource.FromString("Hello Kestrel!")).Build();
1416

1517
await using var host = new TestHost(handler, engine: TestEngine.Kestrel);

Testing/Acceptance/Engine/Kestrel/MappingTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace GenHTTP.Testing.Acceptance.Engine.Kestrel;
66

77
[TestClass]
8-
public class MappingTests
8+
public class MappingTests : KestrelBaseTest
99
{
1010

1111
[TestMethod]
1212
public async Task TestHeaders()
1313
{
14+
if (!CheckKestrel()) return;
15+
1416
var app = Inline.Create().Get((IRequest request) =>
1517
{
1618
var count = request.Headers.Count;
@@ -37,6 +39,8 @@ public async Task TestHeaders()
3739
[TestMethod]
3840
public async Task TestQuery()
3941
{
42+
if (!CheckKestrel()) return;
43+
4044
var app = Inline.Create().Get((IRequest request) =>
4145
{
4246
var count = request.Query.Count;
@@ -63,6 +67,8 @@ public async Task TestQuery()
6367
[TestMethod]
6468
public async Task TestConnection()
6569
{
70+
if (!CheckKestrel()) return;
71+
6672
var app = Inline.Create().Get((IRequest request) =>
6773
{
6874
Assert.IsNotNull(request.Client.Host);

Testing/Acceptance/Engine/Kestrel/ProtocolTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
namespace GenHTTP.Testing.Acceptance.Engine.Kestrel;
99

1010
[TestClass]
11-
public class ProtocolTests
11+
public class ProtocolTests : KestrelBaseTest
1212
{
1313

1414
[TestMethod]
1515
public async Task TestHttp2And3()
1616
{
17+
if (!CheckKestrel()) return;
18+
1719
var logic = Inline.Create().Get((IRequest request) => request.ProtocolType);
1820

1921
var client = GetClient();

Testing/Acceptance/MultiEngineTest.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,25 @@ public class MultiEngineTestAttribute : Attribute, ITestDataSource
1313

1414
public IEnumerable<object[]> GetData(MethodInfo methodInfo)
1515
{
16-
return new List<object[]>
16+
var engine = Environment.GetEnvironmentVariable("TEST_ENGINE");
17+
18+
if (engine == null) {
19+
return new List<object[]>
20+
{
21+
new object[] { TestEngine.Internal },
22+
new object[] { TestEngine.Kestrel }
23+
};
24+
}
25+
26+
if (Enum.TryParse(engine, out TestEngine found))
1727
{
18-
new object[] { TestEngine.Internal },
19-
new object[] { TestEngine.Kestrel }
20-
};
28+
return new List<object[]>
29+
{
30+
new object[] { found }
31+
};
32+
}
33+
34+
throw new InvalidOperationException($"Engine '{engine}' is not supported");
2135
}
2236

2337
public string GetDisplayName(MethodInfo methodInfo, object?[]? data)

0 commit comments

Comments
 (0)