fix(ci): 修复CI工作流中的.NET SDK版本配置和测试报告生成

- 修正了.NET SDK版本配置,支持多个版本并移除重复配置
- 更新了测试结果文件命名格式以避免冲突
- 修复了CTRF报告生成的路径和参数配置
- 移除了调试步骤中的条件检查逻辑
This commit is contained in:
GeWuYou 2026-01-29 19:23:34 +08:00
parent 524ceff770
commit c46cfa265e

View File

@ -35,12 +35,13 @@ jobs:
# 当前提交哈希,作为扫描的目标版本 # 当前提交哈希,作为扫描的目标版本
head: ${{ github.sha }} head: ${{ github.sha }}
# 安装和配置.NET SDK版本9.0.x # 安装和配置.NET SDK版本
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v5 uses: actions/setup-dotnet@v5
with: with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x dotnet-version: 9.0.x
dotnet-version: 10.0.x
# 配置NuGet包缓存以加速后续构建 # 配置NuGet包缓存以加速后续构建
- name: Cache NuGet packages - name: Cache NuGet packages
uses: actions/cache@v5 uses: actions/cache@v5
@ -64,9 +65,12 @@ jobs:
dotnet test \ dotnet test \
-c Release \ -c Release \
--no-build \ --no-build \
--logger trx \ --logger "trx;LogFileName=testResults-$(date +%s).trx" \
--results-directory TestResults --results-directory TestResults
dotnet tool run DotnetCtrfJsonReporter -t "TestResults/testResults.trx" - name: Generate CTRF report
run: |
latest=$(ls -t TestResults/*.trx | head -n 1)
dotnet tool run DotnetCtrfJsonReporter -p "$latest" -t nunit
- name: Debug - Verify CTRF files - name: Debug - Verify CTRF files
if: always() if: always()
run: | run: |