From 759ce5f1fd9f54593d75e54d40a018ba8b764abe Mon Sep 17 00:00:00 2001 From: Erik Shafer Date: Thu, 25 Jun 2026 19:10:53 -0500 Subject: [PATCH] ci: fail the build when a project is missing from CritterCab.slnx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI restores, builds, and tests CritterCab.slnx explicitly — the slnx enumerates each project with no glob, making it the single source of truth for what CI sees. A *.Tests.csproj added to disk but not hand- added to the slnx would silently never run, and the check would still go green. That trap is inert today (one service, two projects) but armed to fire the moment the second service (Telemetry) lands with its own test project. This adds a pre-build guard that fails CI with a clear error if any *.csproj on disk is absent from the slnx, keeping test discovery omission-proof as new services are added. Guard logic verified locally: passes for the current two projects and flags a simulated forgotten Telemetry service. --- .github/workflows/dotnet.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index a6ca604..94ab3a6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -29,6 +29,27 @@ jobs: - name: Checkout uses: actions/checkout@v4 + # CI restores/builds/tests CritterCab.slnx explicitly (no glob), so the + # slnx is the single source of truth for what CI sees. A *.Tests.csproj + # added to disk but not hand-added to the slnx would silently never run + # and the check would still go green. This guard fails the build on that + # drift, keeping test discovery omission-proof as new services land. + - name: Verify solution completeness + shell: bash + run: | + missing=0 + while IFS= read -r proj; do + rel="${proj#./}" + if ! grep -qF "$rel" CritterCab.slnx; then + echo "::error::Project '$rel' exists on disk but is not referenced in CritterCab.slnx" + missing=1 + fi + done < <(find . -name '*.csproj') + if [ "$missing" -eq 0 ]; then + echo "All projects on disk are referenced in CritterCab.slnx." + fi + exit $missing + - name: Setup .NET uses: actions/setup-dotnet@v4 with: