Skip to content

Commit 46841e5

Browse files
committed
Refine CI: run explicit xUnit tests per project
Previously, the CI ran "Explicit" xUnit tests across the entire solution, causing failures for projects without explicit tests. Now, the workflow targets only projects known to contain explicit tests, running dotnet test individually for each. This avoids unnecessary failures and ensures only relevant tests are executed.
1 parent 3d2df6a commit 46841e5

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,21 @@ jobs:
7373
fi
7474
echo "Overlay applied to ${count} xunit.runner.json file(s)."
7575
76+
# Only test projects that define TestMode=Explicit tests. Solution-wide `dotnet test`
77+
# fails on other assemblies with: No test matches the given testcase filter.
78+
# `dotnet test` accepts one .csproj per invocation (SDK 10+).
7679
- name: Test (Explicit only, sequential xUnit)
7780
run: |
78-
dotnet test Source/KZDev.PerfUtils.slnx -c Release --no-build \
79-
--filter "TestMode=Explicit" \
80-
-- xUnit.Explicit=only xUnit.MaxParallelThreads=1 xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false
81+
set -euo pipefail
82+
explicit_projects=(
83+
Source/Tst/KZDev.PerfUtils.Memory.Heap.Sequential.UnitTests/KZDev.PerfUtils.Memory.Heap.Sequential.UnitTests.csproj
84+
Source/Tst/KZDev.PerfUtils.Memory.Heap.UnitTests/KZDev.PerfUtils.Memory.Heap.UnitTests.csproj
85+
Source/Tst/KZDev.PerfUtils.Memory.Native.UnitTests/KZDev.PerfUtils.Memory.Native.UnitTests.csproj
86+
Source/Tst/KZDev.PerfUtils.Memory.Fixed.UnitTests/KZDev.PerfUtils.Memory.Fixed.UnitTests.csproj
87+
Source/Tst/KZDev.PerfUtils.Memory.UnitTests/KZDev.PerfUtils.Memory.UnitTests.csproj
88+
)
89+
for proj in "${explicit_projects[@]}"; do
90+
dotnet test "$proj" -c Release --no-build \
91+
--filter "TestMode=Explicit" \
92+
-- xUnit.Explicit=only xUnit.MaxParallelThreads=1 xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false
93+
done

0 commit comments

Comments
 (0)