Update dotnet-aot-check.yaml #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: dotnet-aot-check | ||
|
Check failure on line 1 in .github/workflows/dotnet-aot-check.yaml
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| jobs: | ||
| aot-compile-check: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [windows-latest, ubuntu-latest] | ||
| runtime: [win-x64, linux-x64] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET SDK | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: | ||
| - '8.0.x' | ||
| - name: Restore dependencies | ||
| run: dotnet restore ./src/c#/GeneralUpdate.sln | ||
| - name: Check AOT compilation | ||
| # 修正:用引号包裹表达式,避免YAML解析器误判特殊字符(第29行) | ||
| shell: "${{ matrix.os == 'windows-latest' ? 'pwsh' : 'bash' }}" | ||
| run: | | ||
| dotnet publish ./src/c#/GeneralUpdate.Client/GeneralUpdate.Client.csproj \ | ||
| -c Release \ | ||
| -f net8.0 \ | ||
| -r ${{ matrix.runtime }} \ | ||
| --self-contained true \ | ||
| -p:PublishAot=true \ | ||
| -p:EnableCompilationRelaxations=false | ||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| - name: Verify AOT output | ||
| shell: pwsh | ||
| run: | | ||
| $publishDir = "./src/c#/GeneralUpdate.Client/bin/Release/net8.0/${{ matrix.runtime }}/publish" | ||
| if ($env:RUNNER_OS -eq "Windows" -and -not (Test-Path "$publishDir/GeneralUpdate.Client.exe")) { | ||
| throw "AOT executable not found for Windows: $publishDir/GeneralUpdate.Client.exe" | ||
| } | ||
| if ($env:RUNNER_OS -eq "Linux" -and -not (Test-Path "$publishDir/GeneralUpdate.Client")) { | ||
| throw "AOT executable not found for Linux: $publishDir/GeneralUpdate.Client" | ||
| } | ||