Skip to content

Commit 36676b8

Browse files
committed
Create dotnet-aot-check.yaml
1 parent b4f06b4 commit 36676b8

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: dotnet-aot-check
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
aot-compile-check:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [windows-latest, ubuntu-latest]
11+
runtime: [win-x64, linux-x64]
12+
include:
13+
- os: windows-latest
14+
runtime: win-x64
15+
- os: ubuntu-latest
16+
runtime: linux-x64
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup .NET SDK
22+
uses: actions/setup-dotnet@v2
23+
with:
24+
dotnet-version: '9.0.x'
25+
26+
- name: Restore dependencies
27+
run: dotnet restore ./src/c#/GeneralUpdate.sln
28+
29+
- name: Check AOT compilation
30+
run: |
31+
dotnet publish ./src/c#/GeneralUpdate.Client/GeneralUpdate.Client.csproj \
32+
-c Release \
33+
-r ${{ matrix.runtime }} \
34+
--self-contained true \
35+
-p:PublishAot=true \
36+
-p:EnableCompilationRelaxations=false
37+
env:
38+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
39+
40+
- name: Verify AOT output
41+
run: |
42+
$publishDir = "./src/c#/GeneralUpdate.Client/bin/Release/net9.0/${{ matrix.runtime }}/publish"
43+
if (-not (Test-Path "$publishDir/GeneralUpdate.Client.exe" -PathType Leaf) -and '${{ matrix.runtime }}' -eq 'win-x64') {
44+
throw "AOT compiled executable not found for Windows"
45+
}
46+
if (-not (Test-Path "$publishDir/GeneralUpdate.Client" -PathType Leaf) -and '${{ matrix.runtime }}' -eq 'linux-x64') {
47+
throw "AOT compiled executable not found for Linux"
48+
}
49+
shell: pwsh

0 commit comments

Comments
 (0)