From ffc4ba101e81410c32f659dc22c69f4225f86d81 Mon Sep 17 00:00:00 2001 From: Kentaro Hakase Date: Wed, 12 Aug 2026 02:06:25 +0200 Subject: [PATCH] Share the build settings and start measuring coverage Both projects declared TargetFramework, Nullable and ImplicitUsings themselves, and the test project inherited neither the analyzers nor the warning policy, so test code was warning free only by omission. The shared settings move into Directory.Build.props and both project files keep just what is specific to them. Warnings are errors in every configuration now, not only in Release. A local Debug build accepted what the Release build in CI rejected, so a warning showed up after the push instead of before it. Both projects build clean in Debug and Release, so this costs nothing today. AnalysisMode stays at its default on purpose. Raising it to Recommended surfaces about 300 analyzer warnings and All about 1100, mostly CA1305, CA1822, CA2007 and CA1515. That is a cleanup in its own right and would only block every later change if it were switched on here. The SDK is pinned to the 10.0 feature band with rollForward so a future major does not silently change the build. Finally, coverlet was referenced but never used: the test run collects coverage now and CI keeps the report as an artifact. The current line rate is 49 percent. --- .github/workflows/ci.yml | 10 +++++++- .../AudioQualityEnhancer.Tests.csproj | 4 +-- AudioQualityEnhancer.csproj | 10 +------- Directory.Build.props | 25 +++++++++++++++++++ global.json | 6 +++++ 5 files changed, 42 insertions(+), 13 deletions(-) create mode 100644 Directory.Build.props create mode 100644 global.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b20dc35..891b621 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,4 +27,12 @@ jobs: run: dotnet build .\AudioQualityEnhancer.slnx -c Release - name: Test - run: dotnet test .\AudioQualityEnhancer.slnx -c Release --no-build + run: dotnet test .\AudioQualityEnhancer.slnx -c Release --no-build --collect:"XPlat Code Coverage" --results-directory TestResults + + - name: Upload coverage + if: always() + uses: actions/upload-artifact@v6 + with: + name: coverage + path: TestResults\**\coverage.cobertura.xml + if-no-files-found: error diff --git a/AudioQualityEnhancer.Tests/AudioQualityEnhancer.Tests.csproj b/AudioQualityEnhancer.Tests/AudioQualityEnhancer.Tests.csproj index 8b931f9..916e5df 100644 --- a/AudioQualityEnhancer.Tests/AudioQualityEnhancer.Tests.csproj +++ b/AudioQualityEnhancer.Tests/AudioQualityEnhancer.Tests.csproj @@ -1,9 +1,7 @@  + - net10.0-windows - enable - enable false diff --git a/AudioQualityEnhancer.csproj b/AudioQualityEnhancer.csproj index b280f31..2224e11 100644 --- a/AudioQualityEnhancer.csproj +++ b/AudioQualityEnhancer.csproj @@ -1,12 +1,8 @@  + WinExe - net10.0-windows - enable - enable - latest - true app.manifest true true @@ -14,10 +10,6 @@ 0.17.0 - - true - - diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..bdabe66 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,25 @@ + + + + net10.0-windows + enable + enable + latest + true + + + + + true + + + diff --git a/global.json b/global.json new file mode 100644 index 0000000..512142d --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestFeature" + } +}