Skip to content

Update dotnet-aot-check.yaml #8

Update dotnet-aot-check.yaml

Update dotnet-aot-check.yaml #8

name: dotnet-aot-check
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:
- uses: actions/checkout@v4
- name: Setup .NET SDK(多版本)
uses: actions/setup-dotnet@v4
with:
# 关键:数组项必须比 dotnet-version: 多缩进 2 个空格(仅用空格,禁止Tab)
dotnet-version:
- '8.0.x'
- name: Restore dependencies
run: dotnet restore ./src/c#/GeneralUpdate.sln
- name: Check AOT compilation(指定 net8.0 框架)
shell: ${{ matrix.os == 'windows-latest' ? 'pwsh' : 'bash' }}

Check failure on line 27 in .github/workflows/dotnet-aot-check.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/dotnet-aot-check.yaml

Invalid workflow file

You have an error in your yaml syntax on line 27
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 compiled executable not found for Windows: $publishDir/GeneralUpdate.Client.exe"
}
if ($env:RUNNER_OS -eq "Linux" -and -not (Test-Path "$publishDir/GeneralUpdate.Client")) {
throw "AOT compiled executable not found for Linux: $publishDir/GeneralUpdate.Client"
}