Skip to content

Commit ba0e0f3

Browse files
committed
Update dotnet-aot-check.yaml
1 parent d91cfcf commit ba0e0f3

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
1-
name: Check AOT Support
1+
name: dotnet-ci
22

33
on: [push, pull_request]
44

55
jobs:
6-
check-aot:
7-
runs-on: windows-latest # 也可使用 ubuntu-latest 或 macos-latest
6+
build:
7+
runs-on: windows-latest
88

99
steps:
10-
- uses: actions/checkout@v4
11-
10+
- uses: actions/checkout@v3
1211
- name: Setup .NET SDK
13-
uses: actions/setup-dotnet@v4
12+
uses: actions/setup-dotnet@v4 # 升级到最新版setup-dotnet,确保兼容性
1413
with:
15-
dotnet-version: '9.0.x' # 需使用支持AOT的.NET版本(.NET 7+)
16-
14+
dotnet-version: '9.0.x'
1715
- name: Restore dependencies
18-
run: dotnet restore ./src/c#/GeneralUpdate.sln
16+
run: dotnet restore ./src/c#/GeneralUpdate.sln # 确保所有项目依赖还原
17+
18+
- name: Build
19+
run: dotnet build ./src/c#/GeneralUpdate.sln -c Release --no-restore
1920

20-
- name: Check AOT compatibility
21+
- name: Check AOT support (Client app)
2122
run: |
22-
# 尝试以AOT模式发布项目(以控制台应用为例)
2323
dotnet publish ./src/c#/GeneralUpdate.Client/GeneralUpdate.Client.csproj `
2424
-c Release `
25-
-r win-x64 ` # 根据运行系统选择运行时标识符(如 linux-x64、osx-x64)
26-
-p:PublishAot=true `
25+
-r win-x64 `
26+
/p:PublishAot=true ` # 使用/p:替代-p:,兼容PowerShell参数解析
2727
--self-contained true
28-
continue-on-error: true # 允许命令失败,后续通过日志判断结果
28+
continue-on-error: true # 允许失败,后续判断结果
2929

30-
- name: Analyze result
30+
- name: Analyze AOT result
3131
run: |
32-
# 检查上一步骤的退出码,0表示AOT编译成功,非0表示不支持
3332
if ($LASTEXITCODE -eq 0) {
34-
Write-Host "✅ 项目支持AOT编译"
33+
Write-Host "✅ GeneralUpdate.Client 支持AOT编译"
3534
} else {
36-
Write-Host "❌ 项目不支持AOT编译,请检查错误日志"
37-
exit 1 # 若需要严格检测,可在此处让Workflow失败
35+
Write-Host "❌ GeneralUpdate.Client 不支持AOT编译,请检查错误日志"
36+
exit 1 # 可选:让Workflow失败以提示问题
3837
}

0 commit comments

Comments
 (0)