@@ -3,11 +3,6 @@ name: Test
33on :
44 workflow_call :
55 inputs :
6- dotnet_version :
7- description : " The .NET SDK version to use"
8- required : false
9- default : " 9.0.x"
10- type : string
116 solution_name :
127 description : " Solution file to build and test"
138 required : true
4742 - name : Setup .NET
4843 uses : actions/setup-dotnet@v4
4944 with :
50- dotnet-version : ${{ env.DOTNET_VERSION }}
45+ dotnet-version : |
46+ 9.0.x
47+ 8.0.x
5148
5249 - name : Restore Dependencies
5350 run : dotnet restore ${{ env.SOLUTION_NAME }}
@@ -62,27 +59,30 @@ jobs:
6259 for proj in $(find . -name "*.Tests.csproj"); do
6360 found=true
6461 echo "Inspecting $proj for target frameworks..."
65-
66- # Get target frameworks from the csproj
62+
63+ # Get frameworks
6764 frameworks=$(grep -oPm1 "(?<=<TargetFrameworks>)[^<]+" "$proj" || true)
6865 if [ -z "$frameworks" ]; then
6966 frameworks=$(grep -oPm1 "(?<=<TargetFramework>)[^<]+" "$proj" || true)
7067 fi
71-
68+
7269 if [ -z "$frameworks" ]; then
7370 echo "⚠️ No TargetFramework found in $proj, skipping..."
7471 continue
7572 fi
76-
77- # Split on ';' in case of multi-targeting
73+
74+ # Run once per framework
7875 for fw in $(echo $frameworks | tr ';' ' '); do
7976 echo "Running tests for $proj ($fw)"
77+ results_dir="./TestResults/$fw"
78+ mkdir -p "$results_dir"
79+
8080 dotnet test "$proj" \
8181 --no-build \
8282 --configuration ${{ env.BUILD_CONFIGURATION }} \
8383 --framework $fw \
8484 --logger "trx;LogFileName=$(basename $proj)-$fw.trx" \
85- --results-directory ./TestResults
85+ --results-directory "$results_dir"
8686 done
8787 done
8888
9191 exit 1
9292 fi
9393
94- - name : Upload Test Results
94+ - name : Upload .NET 9.0 Test Results
95+ uses : actions/upload-artifact@v4
96+ if : success() || failure()
97+ with :
98+ name : test-results-net9.0
99+ path : ./TestResults/net9.0/**/*.trx
100+
101+ - name : Upload .NET 8.0 Test Results
95102 uses : actions/upload-artifact@v4
96103 if : success() || failure()
97104 with :
98- name : test-results
99- path : ./TestResults/**/*.trx
105+ name : test-results-net8.0
106+ path : ./TestResults/net8.0/ **/*.trx
0 commit comments