-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AOT Compilation Canary #7458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
AOT Compilation Canary #7458
Changes from all commits
d038796
3caeb97
d02485e
cd34d98
9226aa4
2bbcfb3
c37bb76
b6031d0
a100932
7740d17
2da8e09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| parameters: | ||
| name: '' | ||
| displayName: '' | ||
| vmImage: '' | ||
| run_if: true | ||
| timeoutInMinutes: 10 | ||
|
|
||
| jobs: | ||
| - job: ${{ parameters.name }} | ||
| condition: eq( ${{ parameters.run_if }}, true ) | ||
| displayName: ${{ parameters.displayName }} | ||
| timeoutInMinutes: ${{ parameters.timeoutInMinutes }} | ||
| pool: | ||
| vmImage: ${{ parameters.vmImage }} | ||
| steps: | ||
| - task: UseDotNet@2 | ||
| displayName: 'Use .NET' | ||
| inputs: | ||
| packageType: 'sdk' | ||
| useGlobalJson: true | ||
|
|
||
| # Option 1: Use inline script to handle paths properly | ||
| - task: PowerShell@2 | ||
| inputs: | ||
| targetType: 'inline' | ||
| script: | | ||
| ./scripts/test-aot-compatibility.ps1 net8.0 | ||
| pwsh: true | ||
|
|
||
| - script: 'echo 1>&2' | ||
| failOnStderr: true | ||
| displayName: 'If above is partially succeeded, then fail' | ||
| condition: eq(variables['Agent.JobStatus'], 'SucceededWithIssues') |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| param([string]$targetNetFramework = "net8.0") | ||
|
|
||
| $rootDirectory = Split-Path $PSScriptRoot -Parent | ||
| $publishOutput = dotnet publish $rootDirectory/src/aot/Akka.AOT.App/Akka.AOT.App.csproj -nodeReuse:false /p:UseSharedCompilation=false /p:ExposeExperimentalFeatures=true | ||
|
|
||
| $actualWarningCount = 0 | ||
|
|
||
| foreach ($line in $($publishOutput -split "`r`n")) | ||
| { | ||
| if ($line -like "*analysis warning IL*") | ||
| { | ||
| Write-Host $line | ||
|
|
||
| $actualWarningCount += 1 | ||
| } | ||
| } | ||
|
|
||
| # Determine the OS-specific folder | ||
| $osPlatform = [System.Runtime.InteropServices.RuntimeInformation]::OSDescription | ||
| if ($osPlatform -match "Windows") { | ||
| $osFolder = "win-x64" | ||
| } else { | ||
| $osFolder = "linux-x64" | ||
| # Default to linux | ||
| } | ||
|
|
||
| $testAppPath = Join-Path -Path $rootDirectory/src/aot/Akka.AOT.App/bin/Release/$targetNetFramework -ChildPath $osFolder/publish | ||
|
|
||
| if (-Not (Test-Path $testAppPath)) { | ||
| Write-Error "Test App path does not exist: $testAppPath" | ||
| Exit 1 | ||
| } | ||
|
|
||
| Write-Host $testAppPath | ||
| pushd $testAppPath | ||
|
|
||
| Write-Host "Executing test App..." | ||
| if ($osPlatform -match "Windows") { | ||
| ./Akka.AOT.App.exe | ||
| } else { | ||
| # Default to linux | ||
| ./Akka.AOT.App | ||
| } | ||
|
|
||
| Write-Host "Finished executing test App" | ||
|
|
||
| if ($LastExitCode -ne 0) | ||
| { | ||
| Write-Host "There was an error while executing AotCompatibility Test App. LastExitCode is:", $LastExitCode | ||
| } | ||
|
|
||
| popd | ||
|
|
||
| Write-Host "Actual warning count is:", $actualWarningCount | ||
| $expectedWarningCount = 0 | ||
|
|
||
| $testPassed = 0 | ||
| if ($actualWarningCount -ne $expectedWarningCount) | ||
| { | ||
| $testPassed = 1 | ||
| Write-Host "Actual warning count:", $actualWarningCount, "is not as expected. Expected warning count is:", $expectedWarningCount | ||
| } | ||
|
|
||
| Exit $testPassed |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // ----------------------------------------------------------------------- | ||
| // <copyright file="AotReceiveActor.cs" company="Akka.NET Project"> | ||
| // Copyright (C) 2009-2025 Lightbend Inc. <http://www.lightbend.com> | ||
| // Copyright (C) 2013-2025 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
| // </copyright> | ||
| // ----------------------------------------------------------------------- | ||
|
|
||
| using Akka.Actor; | ||
|
|
||
| namespace Akka.AOT.App.Actors; | ||
|
|
||
| public class AotReceiveActor : ReceiveActor | ||
| { | ||
| public AotReceiveActor() | ||
| { | ||
| ReceiveAny(o => Sender.Tell(o)); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We know |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // ----------------------------------------------------------------------- | ||
| // <copyright file="AotUntypedActor.cs" company="Akka.NET Project"> | ||
| // Copyright (C) 2009-2025 Lightbend Inc. <http://www.lightbend.com> | ||
| // Copyright (C) 2013-2025 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
| // </copyright> | ||
| // ----------------------------------------------------------------------- | ||
|
|
||
| using Akka.Actor; | ||
|
|
||
| namespace Akka.AOT.App.Actors; | ||
|
|
||
| public class AotUntypedActor : UntypedActor | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably need to add more cases to the canary over time, such as:
Just to gradually add full trim coverage to everything in the default |
||
| { | ||
| protected override void OnReceive(object message) | ||
| { | ||
| Sender.Tell(message); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFramework>$(NetTestVersion)</TargetFramework> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <Nullable>enable</Nullable> | ||
|
|
||
| <IsPackable>false</IsPackable> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Label="AotSettings"> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are all the MSBUILD settings needed to get the compiler to produce the AOT warnings we're looking for |
||
| <PublishAot>true</PublishAot> | ||
| <TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
| <SelfContained>true</SelfContained> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\core\Akka\Akka.csproj"/> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| using Akka.Actor; | ||
| using Akka.AOT.App.Actors; | ||
|
|
||
| namespace Akka.AOT.App; | ||
|
|
||
| class Program | ||
| { | ||
| static async Task Main(string[] args) | ||
| { | ||
| var system = ActorSystem.Create("MySystem"); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does some end to end messaging and uses the default configuration loading, which currently triggers a number of AOT warnings due to how we load |
||
|
|
||
| // create AotUntypedActor | ||
| var untypedActorProps = Props.Create(() => new AotUntypedActor()); | ||
| var untypedActor = system.ActorOf(untypedActorProps, "untyped-actor"); | ||
|
|
||
| // create AotReceiveActor | ||
| var receiveActorProps = Props.Create(() => new AotReceiveActor()); | ||
| var receiveActor = system.ActorOf(receiveActorProps, "receive-actor"); | ||
|
|
||
| // send a message to both actors | ||
| Console.WriteLine(await untypedActor.Ask("Hello, untyped actor!")); | ||
| Console.WriteLine(await receiveActor.Ask("Hello, receive actor!")); | ||
|
|
||
| // terminate the actor system | ||
| await system.Terminate(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do AOT on both Windows and Linux just in-case there are platform-specific issues. Should never happen, but you never know.