Skip to content

Commit ae4adfa

Browse files
author
MPCoreDeveloper
committed
ci: fail on deprecated and vulnerable NuGet packages; align server package baselines
1 parent 0e818b4 commit ae4adfa

9 files changed

Lines changed: 398 additions & 4 deletions

File tree

.github/copilot-instructions.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@
66
- Provide periodic progress updates while work is ongoing to ensure the assistant is not stuck.
77

88
## Code Style
9-
- Use specific formatting rules
10-
- Follow naming conventions
9+
- Use specific formatting rules.
10+
- Follow naming conventions.
11+
- Use native .NET 10 code and C# 14 across SharpCoreDB; do not suggest downgrading framework or assuming pre-.NET 10 context.
12+
13+
## Package Policy
14+
- Prefer latest stable released NuGet packages and package versions.
15+
- Prefer Microsoft-backed packages by default.
16+
- If a non-Microsoft package is used (e.g., Serilog), keep it on latest stable and avoid deprecated versions.
17+
- Avoid prerelease packages unless explicitly requested.
1118

1219
## Project-Specific Rules
13-
- Custom requirement A
14-
- Custom requirement B
20+
- Custom requirement A.
21+
- Custom requirement B.
1522
- Require full SQLite compatibility: SharpCoreDB sync and provider must support all SQLite syntax/features users could use, never less; extra capabilities are fine.

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
time: "06:00"
8+
timezone: "Europe/Amsterdam"
9+
open-pull-requests-limit: 20
10+
labels:
11+
- "dependencies"
12+
- "nuget"
13+
commit-message:
14+
prefix: "deps"
15+
include: "scope"
16+
groups:
17+
dotnet-microsoft:
18+
patterns:
19+
- "Microsoft.*"
20+
- "System.*"
21+
- "Aspire.*"
22+
- "Grpc.*"
23+
- "OpenTelemetry.*"
24+
serilog:
25+
patterns:
26+
- "Serilog*"
27+
28+
- package-ecosystem: "github-actions"
29+
directory: "/"
30+
schedule:
31+
interval: "weekly"
32+
day: "monday"
33+
time: "06:00"
34+
timezone: "Europe/Amsterdam"
35+
labels:
36+
- "dependencies"
37+
- "github-actions"

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,44 @@ jobs:
4242
- name: Restore dependencies
4343
run: dotnet restore SharpCoreDB.CI.slnf
4444

45+
- name: Fail on deprecated NuGet packages
46+
shell: pwsh
47+
run: |
48+
$output = dotnet list SharpCoreDB.CI.slnf package --deprecated
49+
$outputText = $output | Out-String
50+
Write-Host $outputText
51+
52+
if ($LASTEXITCODE -ne 0) {
53+
Write-Error "Failed to evaluate deprecated packages."
54+
exit $LASTEXITCODE
55+
}
56+
57+
if ($outputText -match "has the following deprecated packages") {
58+
Write-Error "Deprecated NuGet packages detected. CI is configured to fail."
59+
exit 1
60+
}
61+
62+
Write-Host "No deprecated NuGet packages detected."
63+
64+
- name: Fail on vulnerable NuGet packages
65+
shell: pwsh
66+
run: |
67+
$output = dotnet list SharpCoreDB.CI.slnf package --vulnerable
68+
$outputText = $output | Out-String
69+
Write-Host $outputText
70+
71+
if ($LASTEXITCODE -ne 0) {
72+
Write-Error "Failed to evaluate vulnerable packages."
73+
exit $LASTEXITCODE
74+
}
75+
76+
if ($outputText -match "has the following vulnerable packages") {
77+
Write-Error "Vulnerable NuGet packages detected. CI is configured to fail."
78+
exit 1
79+
}
80+
81+
Write-Host "No vulnerable NuGet packages detected."
82+
4583
- name: Build
4684
run: dotnet build SharpCoreDB.CI.slnf --configuration Release --no-restore /p:ContinuousIntegrationBuild=true
4785

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<LangVersion>14.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
10+
<!-- Assembly info -->
11+
<AssemblyName>SharpCoreDB.Client.Protocol</AssemblyName>
12+
<Version>1.5.0</Version>
13+
<Description>Client-side protocol implementation for SharpCoreDB (gRPC, binary)</Description>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<!-- gRPC & Protobuf (latest stable) -->
18+
<PackageReference Include="Grpc.Net.Client" Version="2.70.0" />
19+
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
20+
<PackageReference Include="Grpc.Tools" Version="2.70.0" PrivateAssets="All" />
21+
22+
<!-- Include .proto files (shared with server) -->
23+
<Protobuf Include="..\SharpCoreDB.Server.Protocol\Protos\*.proto" GrpcServices="Client" Link="Protos\%(Filename)%(Extension)" />
24+
</ItemGroup>
25+
26+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<LangVersion>14.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
10+
<!-- Assembly info -->
11+
<AssemblyName>SharpCoreDB.Client</AssemblyName>
12+
<Version>1.5.0</Version>
13+
<Description>.NET client library for SharpCoreDB network server (ADO.NET-like API)</Description>
14+
15+
<!-- NuGet packaging -->
16+
<PackageId>SharpCoreDB.Client</PackageId>
17+
<Authors>MPCoreDeveloper</Authors>
18+
<Company>SharpCoreDB</Company>
19+
<Product>SharpCoreDB.Client</Product>
20+
<PackageTags>database;client;grpc;adonet;sharpcoredb</PackageTags>
21+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
22+
<PackageProjectUrl>https://github.com/MPCoreDeveloper/SharpCoreDB</PackageProjectUrl>
23+
<RepositoryUrl>https://github.com/MPCoreDeveloper/SharpCoreDB</RepositoryUrl>
24+
</PropertyGroup>
25+
26+
<ItemGroup>
27+
<!-- gRPC Client (latest stable) -->
28+
<PackageReference Include="Grpc.Net.Client" Version="2.70.0" />
29+
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
30+
31+
<!-- Connection pooling -->
32+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.3" />
33+
</ItemGroup>
34+
35+
<ItemGroup>
36+
<!-- Project references -->
37+
<ProjectReference Include="..\SharpCoreDB.Client.Protocol\SharpCoreDB.Client.Protocol.csproj" />
38+
</ItemGroup>
39+
40+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<LangVersion>14.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
10+
<!-- Assembly info -->
11+
<AssemblyName>SharpCoreDB.Server.Core</AssemblyName>
12+
<Version>1.5.0</Version>
13+
<Description>Core server infrastructure for SharpCoreDB network server</Description>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<!-- Core dependencies (.NET 10 - latest stable) -->
18+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.3" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
20+
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.3" />
21+
22+
<!-- Async utilities -->
23+
<PackageReference Include="System.Threading.Channels" Version="10.0.3" />
24+
25+
<!-- Security (latest stable for .NET 10 - updated to non-deprecated) -->
26+
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.4.0" />
27+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.4.0" />
28+
</ItemGroup>
29+
30+
<ItemGroup>
31+
<!-- Project references -->
32+
<ProjectReference Include="..\SharpCoreDB\SharpCoreDB.csproj" />
33+
<ProjectReference Include="..\SharpCoreDB.Server.Protocol\SharpCoreDB.Server.Protocol.csproj" />
34+
</ItemGroup>
35+
36+
<ItemGroup>
37+
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="10.0.103" />
38+
</ItemGroup>
39+
40+
</Project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<LangVersion>14.0</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
10+
<!-- Assembly info -->
11+
<AssemblyName>SharpCoreDB.Server.Protocol</AssemblyName>
12+
<Version>1.5.0</Version>
13+
<Description>Network protocol definitions for SharpCoreDB server (gRPC, binary, HTTP)</Description>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<!-- gRPC & Protobuf (latest stable for .NET 10) -->
18+
<PackageReference Include="Grpc.Core.Api" Version="2.70.0" />
19+
<PackageReference Include="Grpc.Tools" Version="2.70.0" PrivateAssets="All" />
20+
<PackageReference Include="Google.Protobuf" Version="3.29.3" />
21+
22+
<!-- Include .proto files -->
23+
<Protobuf Include="Protos\*.proto" GrpcServices="Both" />
24+
</ItemGroup>
25+
26+
<ItemGroup>
27+
<!-- Folder for proto files -->
28+
<None Remove="Protos\**\*.proto" />
29+
</ItemGroup>
30+
31+
</Project>

src/SharpCoreDB.Server/Program.cs

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// <copyright file="Program.cs" company="MPCoreDeveloper">
2+
// Copyright (c) 2026 MPCoreDeveloper and GitHub Copilot. All rights reserved.
3+
// Licensed under the MIT License.
4+
// </copyright>
5+
6+
using Microsoft.AspNetCore.Server.Kestrel.Core;
7+
using Serilog;
8+
using SharpCoreDB.Server.Core;
9+
10+
// Create and configure the host
11+
var builder = WebApplication.CreateBuilder(args);
12+
13+
// Configure Serilog
14+
Log.Logger = new LoggerConfiguration()
15+
.ReadFrom.Configuration(builder.Configuration)
16+
.Enrich.FromLogContext()
17+
.WriteTo.Console()
18+
.WriteTo.File(
19+
"logs/sharpcoredb-server-.log",
20+
rollingInterval: RollingInterval.Day,
21+
retainedFileCountLimit: 30)
22+
.CreateLogger();
23+
24+
builder.Host.UseSerilog();
25+
26+
// Configure Kestrel for gRPC and HTTP
27+
builder.WebHost.ConfigureKestrel((context, options) =>
28+
{
29+
var config = context.Configuration.GetSection("Server").Get<ServerConfiguration>();
30+
if (config is null)
31+
{
32+
throw new InvalidOperationException("Server configuration is missing");
33+
}
34+
35+
// gRPC endpoint
36+
if (config.EnableGrpc)
37+
{
38+
options.ListenAnyIP(config.GrpcPort, listenOptions =>
39+
{
40+
listenOptions.Protocols = HttpProtocols.Http2;
41+
42+
if (config.Security.TlsEnabled && config.Security.TlsCertificatePath is not null)
43+
{
44+
listenOptions.UseHttps(config.Security.TlsCertificatePath, config.Security.TlsPrivateKeyPath);
45+
}
46+
});
47+
}
48+
49+
// HTTP REST API endpoint
50+
if (config.EnableHttp)
51+
{
52+
options.ListenAnyIP(config.HttpPort, listenOptions =>
53+
{
54+
listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
55+
});
56+
}
57+
});
58+
59+
// Add services
60+
builder.Services.AddGrpc(options =>
61+
{
62+
options.MaxReceiveMessageSize = 100 * 1024 * 1024; // 100MB
63+
options.MaxSendMessageSize = 100 * 1024 * 1024;
64+
});
65+
66+
builder.Services.AddGrpcReflection();
67+
68+
// Add server configuration
69+
builder.Services.Configure<ServerConfiguration>(
70+
builder.Configuration.GetSection("Server"));
71+
72+
// Add core services
73+
builder.Services.AddSingleton<NetworkServer>();
74+
75+
// Add health checks
76+
builder.Services.AddHealthChecks();
77+
78+
var app = builder.Build();
79+
80+
// Map gRPC services
81+
// TODO: Add gRPC service implementations in Phase 1, Week 2
82+
// app.MapGrpcService<DatabaseServiceImpl>();
83+
// app.MapGrpcService<VectorSearchServiceImpl>();
84+
85+
// Enable gRPC reflection for development
86+
if (app.Environment.IsDevelopment())
87+
{
88+
app.MapGrpcReflectionService();
89+
}
90+
91+
// Map health check endpoint
92+
app.MapHealthChecks("/health");
93+
94+
// Map REST API endpoints (placeholder)
95+
app.MapGet("/", () => new
96+
{
97+
name = "SharpCoreDB Server",
98+
version = "1.5.0",
99+
status = "running",
100+
observability = "Serilog + HealthChecks"
101+
});
102+
103+
// Start the server
104+
Log.Information("Starting SharpCoreDB Server v1.5.0");
105+
Log.Information("gRPC endpoint: {GrpcEndpoint}", $"http://localhost:{builder.Configuration["Server:GrpcPort"] ?? "5001"}");
106+
Log.Information("HTTP endpoint: {HttpEndpoint}", $"http://localhost:{builder.Configuration["Server:HttpPort"] ?? "8080"}");
107+
108+
try
109+
{
110+
// Start the network server
111+
var networkServer = app.Services.GetRequiredService<NetworkServer>();
112+
await networkServer.StartAsync(app.Lifetime.ApplicationStopping);
113+
114+
// Run the web host
115+
await app.RunAsync();
116+
}
117+
catch (Exception ex)
118+
{
119+
Log.Fatal(ex, "SharpCoreDB Server terminated unexpectedly");
120+
}
121+
finally
122+
{
123+
Log.Information("SharpCoreDB Server shutdown complete");
124+
await Log.CloseAndFlushAsync();
125+
}

0 commit comments

Comments
 (0)