Skip to content

Commit f7f5dbb

Browse files
committed
Move server projects to src/ and add redirect middleware integration tests
1 parent 4f1b4d5 commit f7f5dbb

22 files changed

Lines changed: 214 additions & 60 deletions

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ jobs:
3030

3131
- name: Build container
3232
run: dotnet build.cs container
33+
34+
- name: Run tests
35+
run: dotnet build.cs dotnet-test

.github/workflows/link-checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ jobs:
3838
env:
3939
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
4040
with:
41-
args: '--header ''x-origin-verify: ${{ secrets.ORIGIN_VERIFICATION_HEADER_VALUE }}'' --no-progress --max-concurrency 8 --skip-missing --accept 200,429 --exclude-path server/Docs.Web/wwwroot/_llms-txt --exclude-path server/Docs.Web/wwwroot/llms.txt --exclude-path server/Docs.Web/wwwroot/llms-full.txt --exclude-path server/Docs.Web/wwwroot/llms-small.txt --exclude-loopback --require-https --exclude sample.duendesoftware.com --exclude "docs.duendesoftware.com/404" --exclude sitemap --exclude "https://github.com/DuendeArchive/IdentityModel.AspNetCore/" --root-dir "$PWD/server/Docs.Web/wwwroot" server/Docs.Web/wwwroot/**'
41+
args: '--header ''x-origin-verify: ${{ secrets.ORIGIN_VERIFICATION_HEADER_VALUE }}'' --no-progress --max-concurrency 8 --skip-missing --accept 200,429 --exclude-path server/src/Docs.Web/wwwroot/_llms-txt --exclude-path server/src/Docs.Web/wwwroot/llms.txt --exclude-path server/src/Docs.Web/wwwroot/llms-full.txt --exclude-path server/src/Docs.Web/wwwroot/llms-small.txt --exclude-loopback --require-https --exclude sample.duendesoftware.com --exclude "docs.duendesoftware.com/404" --exclude sitemap --exclude "https://github.com/DuendeArchive/IdentityModel.AspNetCore/" --root-dir "$PWD/server/src/Docs.Web/wwwroot" server/src/Docs.Web/wwwroot/**'
4242
fail: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Astro build output
22
astro/dist/
33
astro/root/
4-
server/Docs.Web/wwwroot/
4+
server/src/Docs.Web/wwwroot/
55

66
# generated types
77
astro/.astro/

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ This project uses Astro + Starlight for the documentation site, served by ASP.NE
8282
│ ├── package.json
8383
│ └── tsconfig.json
8484
└── server/ # ASP.NET Core server
85-
├── Docs.Web/ # Static file server
86-
│ └── wwwroot/ # Astro build output (gitignored)
87-
├── Docs.AppHost/ # .NET Aspire orchestrator
88-
└── Docs.ServiceDefaults/ # Shared configuration
85+
├── src/
86+
│ ├── Docs.Web/ # Static file server
87+
│ │ └── wwwroot/ # Astro build output (gitignored)
88+
│ ├── Docs.AppHost/ # .NET Aspire orchestrator
89+
│ └── Docs.ServiceDefaults/ # Shared configuration
90+
└── tests/
91+
└── Docs.Web.Tests/ # Integration tests
8992
```
9093

9194
Starlight looks for `.md` or `.mdx` files in the `astro/src/content/docs/` directory. Each file is exposed as a route based on its file name.

build.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
}
1515

1616
var serverDir = Path.Combine(repoRoot, "server");
17-
var wwwrootDir = Path.Combine(serverDir, "Docs.Web", "wwwroot");
17+
var wwwrootDir = Path.Combine(serverDir, "src", "Docs.Web", "wwwroot");
1818

1919
// Target names
2020
const string Restore = "restore";
2121
const string AstroBuild = "astro-build";
2222
const string DotnetBuild = "dotnet-build";
23+
const string DotnetTest = "dotnet-test";
2324
const string DotnetPublish = "dotnet-publish";
2425
const string Build = "build";
2526
const string Container = "container";
@@ -60,20 +61,25 @@ await RunAsync("docker",
6061
Target(DotnetBuild, dependsOn: [Restore], () =>
6162
RunAsync("dotnet", "build Docs.slnx --no-restore", workingDirectory: serverDir));
6263

64+
Target(DotnetTest, dependsOn: [DotnetBuild], () =>
65+
RunAsync("dotnet", "test Docs.slnx --no-build", workingDirectory: serverDir));
66+
6367
Target(DotnetPublish, dependsOn: [Restore], () =>
64-
RunAsync("dotnet", "publish Docs.Web/Docs.Web.csproj -c Release --no-restore",
68+
RunAsync("dotnet", "publish src/Docs.Web/Docs.Web.csproj -c Release --no-restore",
6569
workingDirectory: serverDir));
6670

6771
Target(Build, dependsOn: [AstroBuild, DotnetBuild]);
6872

73+
Target(Default, dependsOn: [Build, DotnetTest]);
74+
6975
// Container (no Dockerfile needed!)
7076
Target(Container, dependsOn: [AstroBuild], () =>
71-
RunAsync("dotnet", "publish Docs.Web/Docs.Web.csproj -c Release /t:PublishContainer",
77+
RunAsync("dotnet", "publish src/Docs.Web/Docs.Web.csproj -c Release /t:PublishContainer",
7278
workingDirectory: serverDir));
7379

7480
// Dev
7581
Target(Aspire, () =>
76-
RunAsync("dotnet", "run --project Docs.AppHost", workingDirectory: serverDir));
82+
RunAsync("dotnet", "run --project src/Docs.AppHost", workingDirectory: serverDir));
7783

7884
// Quality - Link check builds Astro; actual lychee runs in CI workflow due to secrets
7985
Target(LinkCheck, dependsOn: [AstroBuild], () =>
@@ -91,6 +97,4 @@ await RunAsync("docker",
9197
Directory.Delete(wwwrootDir, recursive: true);
9298
});
9399

94-
Target(Default, dependsOn: [Build]);
95-
96100
await RunTargetsAndExitAsync(args);

server/Docs.slnx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<Solution>
2-
<Project Path="Docs.ServiceDefaults/Docs.ServiceDefaults.csproj"/>
3-
<Project Path="Docs.Web/Docs.Web.csproj"/>
4-
<Project Path="Docs.AppHost/Docs.AppHost.csproj"/>
2+
<Folder Name="/src/">
3+
<Project Path="src/Docs.ServiceDefaults/Docs.ServiceDefaults.csproj"/>
4+
<Project Path="src/Docs.Web/Docs.Web.csproj"/>
5+
<Project Path="src/Docs.AppHost/Docs.AppHost.csproj"/>
6+
</Folder>
7+
<Folder Name="/tests/">
8+
<Project Path="tests/Docs.Web.Tests/Docs.Web.Tests.csproj"/>
9+
</Folder>
510
</Solution>
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var builder = DistributedApplication.CreateBuilder(args);
22

33
// Astro dev server (for local development only)
4-
_ = builder.AddJavaScriptApp("astro", "../astro")
4+
_ = builder.AddJavaScriptApp("astro", "../../astro")
55
.WithHttpEndpoint(port: 4321, env: "PORT")
66
.WithExternalHttpEndpoints();
77

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)