From 0db951cb1b134c4d86c883dae8a6878ba5f5143c Mon Sep 17 00:00:00 2001 From: Seun Akanni Date: Sun, 23 Aug 2026 20:58:13 +0100 Subject: [PATCH 1/3] test(compliance): split the BHoM-free unit tests into a runnable project ComplianceRunner drives five of the seven checks and none of its tests have ever executed. Compliance.Tests ProjectReferences Compliance.Shared, whose HintPaths need a BHoM install plus a built Test_Toolkit, so the whole project has been inert since it was written. Compliance.Unit.Tests carries the three test files that reference no BHoM type and compiles the four source files they cover directly, so it builds and runs on a bare runner. 62 tests now execute in test-tools.yml. The BHoM-dependent files stay where they are, with a comment recording what each one needs and how to enable it. No runner behaviour changed. The three test files moved verbatim. --- .github/workflows/test-tools.yml | 28 +++++++-- tools/ComplianceRunner/Platform.slnx | 1 + .../Compliance.Tests/Compliance.Tests.csproj | 26 ++++++++- .../Compliance.Unit.Tests.csproj | 57 +++++++++++++++++++ .../Unit/ArgParserTests.cs | 0 .../Unit/FileFilterTests.cs | 0 .../Unit/SarifBuilderTests.cs | 0 7 files changed, 105 insertions(+), 7 deletions(-) create mode 100644 tools/ComplianceRunner/tests/Compliance.Unit.Tests/Compliance.Unit.Tests.csproj rename tools/ComplianceRunner/tests/{Compliance.Tests => Compliance.Unit.Tests}/Unit/ArgParserTests.cs (100%) rename tools/ComplianceRunner/tests/{Compliance.Tests => Compliance.Unit.Tests}/Unit/FileFilterTests.cs (100%) rename tools/ComplianceRunner/tests/{Compliance.Tests => Compliance.Unit.Tests}/Unit/SarifBuilderTests.cs (100%) diff --git a/.github/workflows/test-tools.yml b/.github/workflows/test-tools.yml index a80d060..0a58d07 100644 --- a/.github/workflows/test-tools.yml +++ b/.github/workflows/test-tools.yml @@ -6,11 +6,20 @@ # all: PR #131 reported zero. That left every runner regression test inert, including the # one added in #131 to stop the System.Drawing.Common reference being dropped as unused. # -# Compliance.Tests is deliberately NOT run here. Compliance.Shared references BHoM.dll, -# BHoM_Engine.dll, CodeComplianceTest_oM.dll, Test_Engine.dll and Test_oM.dll by HintPath -# out of C:\ProgramData\BHoM\Assemblies, so it cannot even compile without a BHoM install -# plus a built Test_Toolkit. Adding it needs the dependency-resolution step and belongs in -# a separate change; a job that fails for environmental reasons is worse than no job. +# ComplianceRunner's tests are split across two projects, and only one of them can run here. +# +# Compliance.Unit.Tests DOES run: it compiles Annotation.cs, ArgParser.cs, FileFilter.cs and +# SarifBuilder.cs directly, references no BHoM assembly, and so needs nothing installed. +# +# Compliance.Tests is still NOT run. It ProjectReferences Compliance.Shared, which references +# BHoM.dll, BHoM_Engine.dll, CodeComplianceTest_oM.dll, Test_Engine.dll and Test_oM.dll by +# HintPath out of C:\ProgramData\BHoM\Assemblies. The blocker is narrower than the whole set: +# measured on a machine with the BHoM installer present, four of the five resolve and only +# CodeComplianceTest_oM.dll is missing, because it ships with Test_Toolkit rather than in the +# installer payload. AnnotationConvert.cs then fails with CS0234 on BH.oM.Test.CodeCompliance +# and takes the whole project with it. Running it therefore needs resolve-dependencies to +# build Test_Toolkit first, which belongs in a separate change; a job that fails for +# environmental reasons is worse than no job. name: Test Tools on: @@ -41,13 +50,20 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + # Two versions: the Serialiser and Versioning suites target net8.0-windows, matching + # their runners; Compliance.Unit.Tests targets net10.0, matching ComplianceRunner. - name: Set up .NET uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5 with: - dotnet-version: '8.0' + dotnet-version: | + 8.0 + 10.x - name: SerialiserRunner tests run: dotnet test tools/SerialiserRunner/src/SerialiserRunner.Tests --nologo - name: VersioningRunner tests run: dotnet test tools/VersioningRunner/src/VersioningRunner.Tests --nologo + + - name: ComplianceRunner unit tests (BHoM-free) + run: dotnet test tools/ComplianceRunner/tests/Compliance.Unit.Tests --nologo diff --git a/tools/ComplianceRunner/Platform.slnx b/tools/ComplianceRunner/Platform.slnx index da5e1f2..2470a6a 100644 --- a/tools/ComplianceRunner/Platform.slnx +++ b/tools/ComplianceRunner/Platform.slnx @@ -3,4 +3,5 @@ + diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj b/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj index ca84fae..a9eca60 100644 --- a/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj +++ b/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj @@ -20,11 +20,35 @@ + + $(ProgramData)\BHoM\Assemblies\BHoM.dll diff --git a/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Compliance.Unit.Tests.csproj b/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Compliance.Unit.Tests.csproj new file mode 100644 index 0000000..d40cb78 --- /dev/null +++ b/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Compliance.Unit.Tests.csproj @@ -0,0 +1,57 @@ + + + + + + net10.0 + enable + enable + false + Compliance.Tests + + + + + + + + + + + + + + + + + + + diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Unit/ArgParserTests.cs b/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/ArgParserTests.cs similarity index 100% rename from tools/ComplianceRunner/tests/Compliance.Tests/Unit/ArgParserTests.cs rename to tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/ArgParserTests.cs diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Unit/FileFilterTests.cs b/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/FileFilterTests.cs similarity index 100% rename from tools/ComplianceRunner/tests/Compliance.Tests/Unit/FileFilterTests.cs rename to tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/FileFilterTests.cs diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Unit/SarifBuilderTests.cs b/tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/SarifBuilderTests.cs similarity index 100% rename from tools/ComplianceRunner/tests/Compliance.Tests/Unit/SarifBuilderTests.cs rename to tools/ComplianceRunner/tests/Compliance.Unit.Tests/Unit/SarifBuilderTests.cs From 1e2a2a53208ca37bd9a8f548ab2a708346e0d9a6 Mon Sep 17 00:00:00 2001 From: Seun Akanni Date: Mon, 24 Aug 2026 15:53:30 +0100 Subject: [PATCH 2/3] docs(compliance): correct the Compliance.Tests comment now that it runs The comment added by this branch opened "does not run in CI" and closed with what a workflow would have to do to make it run. Both were written when nothing ran this project. It now runs in test-tools.yml's compliance-tests job, which does exactly what that closing paragraph described, so the paragraph is cut rather than reworded. The middle section is unchanged: what stays in this project, why each item cannot move, and the note that the boundary is not unit-versus-integration. --- .../Compliance.Tests/Compliance.Tests.csproj | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj b/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj index a9eca60..a5bd949 100644 --- a/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj +++ b/tools/ComplianceRunner/tests/Compliance.Tests/Compliance.Tests.csproj @@ -21,8 +21,11 @@ From bc0db27f8bec6ab53cc1fc992ee64f88c99e8a8b Mon Sep 17 00:00:00 2001 From: Seun Akanni Date: Mon, 24 Aug 2026 21:12:26 +0100 Subject: [PATCH 3/3] docs(compliance): repoint the FileFilterTests citation after the split PathspecFilterPairingTests cites FileFilterTests twice, and one of those citations is load-bearing: line 20 is the NotAssemblyInfo.cs case this file pairs against. Moving FileFilterTests into Compliance.Unit.Tests leaves both references pointing at a file that is no longer a sibling. The header now names the project the file moved to, and the line citation no longer carries a path, so it survives this move without acquiring one that rots again. The line number is unchanged because the move is verbatim. This touches a file that was not previously part of this pull request. It is here because merging this branch is what makes the existing comment wrong, and leaving a broken pointer for someone else to find is worse than the wider diff. --- .../Integration/PathspecFilterPairingTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/ComplianceRunner/tests/Compliance.Tests/Integration/PathspecFilterPairingTests.cs b/tools/ComplianceRunner/tests/Compliance.Tests/Integration/PathspecFilterPairingTests.cs index d27bd03..a96dc1d 100644 --- a/tools/ComplianceRunner/tests/Compliance.Tests/Integration/PathspecFilterPairingTests.cs +++ b/tools/ComplianceRunner/tests/Compliance.Tests/Integration/PathspecFilterPairingTests.cs @@ -11,7 +11,8 @@ /// 2. ComplianceRunner then asks FileFilter.IsRelevantFile of every file it was handed. /// /// Each half has tests. `.github/scripts/tests/test-changed-file-patterns.sh` asserts the -/// pathspec behaviour against real git, and FileFilterTests asserts the predicate. Neither +/// pathspec behaviour against real git, and FileFilterTests, which lives in the sibling +/// Compliance.Unit.Tests project, asserts the predicate. Neither /// asserts that the two agree, and they do not: the pathspec token `*AssemblyInfo.cs` selects /// any file whose name ENDS with that string, while FileFilter.cs:24 requires the name to /// EQUAL it. A file in between is selected, counted into the skip decision, handed to the @@ -20,9 +21,9 @@ /// These tests are written to PASS against today's behaviour. They record the disagreement so /// it is visible in the suite. Whether the fix narrows the pathspec or widens the filter is /// open: BHoMBot used EndsWith("AssemblyInfo.cs") (ProjectCompliance.cs:33), so widening the -/// filter restores the older semantics, and FileFilterTests.cs:20 currently asserts the -/// narrower one deliberately. Where an assertion would change under one of those two answers, -/// the comment says what it should become and under which answer. +/// filter restores the older semantics, and line 20 of that same FileFilterTests file asserts +/// the narrower one deliberately. Where an assertion would change under one of those two +/// answers, the comment says what it should become and under which answer. /// [TestFixture] [Category("Integration")]