4040 with :
4141 dotnet-version : |
4242 10.0.x
43+ 9.0.x
4344 8.0.x
4445
4546 - name : Restore Dependencies
@@ -52,13 +53,20 @@ jobs:
5253 run : |
5354 mkdir -p TestResults
5455 found=false
56+
57+ tfm_file="./TestResults/_tfms.txt"
58+ : > "$tfm_file"
59+
5560 for proj in $(find . -name "*.Tests.csproj"); do
5661 found=true
5762 frameworks=$(grep -oPm1 "(?<=<TargetFrameworks>)[^<]+" "$proj" || true)
5863 if [ -z "$frameworks" ]; then
5964 frameworks=$(grep -oPm1 "(?<=<TargetFramework>)[^<]+" "$proj" || true)
6065 fi
66+
6167 for fw in $(echo $frameworks | tr ';' ' '); do
68+ echo "$fw" >> "$tfm_file"
69+
6270 results_dir="./TestResults/$fw"
6371 mkdir -p "$results_dir"
6472 dotnet test "$proj" \
@@ -69,26 +77,41 @@ jobs:
6977 --results-directory "$results_dir"
7078 done
7179 done
80+
7281 if [ "$found" = false ]; then
7382 echo "⚠️ No test projects (*.Tests.csproj) were found."
7483 exit 1
7584 fi
7685
77- - name : Ensure .NET 10.0 Results Exist
86+ sort -u "$tfm_file" -o "$tfm_file"
87+ echo "Detected TFMs:"
88+ cat "$tfm_file"
89+
90+ if grep -qx "net10.0" "$tfm_file"; then
91+ echo "PRIMARY_TFM=net10.0" >> $GITHUB_ENV
92+ elif grep -qx "net9.0" "$tfm_file"; then
93+ echo "PRIMARY_TFM=net9.0" >> $GITHUB_ENV
94+ else
95+ echo "PRIMARY_TFM=" >> $GITHUB_ENV
96+ fi
97+
98+ - name : Ensure PRIMARY Results Exist
99+ if : ${{ env.PRIMARY_TFM != '' }}
78100 run : |
79- mkdir -p ./TestResults/net10.0
80- if ! compgen -G "./TestResults/net10.0 /*.trx" > /dev/null; then
81- echo "⚠️ No .NET 10.0 test results" > ./TestResults/net10.0 /placeholder.txt
101+ mkdir -p " ./TestResults/${{ env.PRIMARY_TFM }}"
102+ if ! compgen -G "./TestResults/${{ env.PRIMARY_TFM }} /*.trx" > /dev/null; then
103+ echo "⚠️ No ${{ env.PRIMARY_TFM }} test results" > " ./TestResults/${{ env.PRIMARY_TFM }} /placeholder.txt"
82104 fi
83105
84- - name : Upload .NET 10.0 Test Results
106+ - name : Upload PRIMARY Test Results
107+ if : ${{ env.PRIMARY_TFM != '' }}
85108 uses : actions/upload-artifact@v4
86109 with :
87- name : test-results-net10.0
110+ name : test-results-${{ env.PRIMARY_TFM }}
88111 # only upload trx + placeholder, ignore everything else
89112 path : |
90- ./TestResults/net10.0 /*.trx
91- ./TestResults/net10.0 /placeholder.txt
113+ ./TestResults/${{ env.PRIMARY_TFM }} /*.trx
114+ ./TestResults/${{ env.PRIMARY_TFM }} /placeholder.txt
92115 overwrite : true
93116
94117 - name : Ensure .NET 8.0 Results Exist
0 commit comments