-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform AOT check on repository (#2598)
* Perform AOT check on repository * Use param * Use correct path * Use parameter * Update yml and ps file
- Loading branch information
1 parent
909669f
commit ad64ace
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "AOT Check" | ||
|
||
on: | ||
push: | ||
branches: [ "dev" ] | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
- ready_for_review | ||
branches: [ "dev" ] | ||
|
||
jobs: | ||
analyze: | ||
runs-on: windows-latest | ||
name: Wilson GitHub AOT check | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Runs powershell script | ||
id: aot-powershell | ||
run: build\test-aot.ps1 'net8.0' | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
param([string]$targetNetFramework) | ||
|
||
$projectName='Microsoft.IdentityModel.AotCompatibility.TestApp' | ||
$rootDirectory = Split-Path $PSScriptRoot -Parent | ||
$publishOutput = dotnet publish $rootDirectory/test/$projectName/$projectName.csproj --self-contained -nodeReuse:false /p:UseSharedCompilation=false | ||
|
||
$actualWarningCount = 0 | ||
|
||
foreach ($line in $($publishOutput -split "`r`n")) | ||
{ | ||
if (($line -like "*analysis warning IL*") -or ($line -like "*analysis error IL*")) | ||
{ | ||
Write-Host $line | ||
$actualWarningCount += 1 | ||
} | ||
} | ||
|
||
Write-Host "Actual warning count is: ", $actualWarningCount | ||
$expectedWarningCount = 0 | ||
|
||
if ($LastExitCode -ne 0) | ||
{ | ||
Write-Host "There was an error while publishing AotCompatibility Test App. LastExitCode is:", $LastExitCode | ||
Write-Host $publishOutput | ||
} | ||
|
||
$runtime = if ($IsWindows) { "win-x64" } elseif ($IsMacOS) { "macos-x64"} else {"linux-x64"} | ||
$app = if ($IsWindows ) {"./$projectName.exe" } else {"./projectName" } | ||
|
||
Push-Location $rootDirectory/test/$projectName/bin/Release/$targetNetFramework/win-x64 | ||
|
||
Write-Host "Executing test App..." | ||
$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 | ||
} | ||
|
||
Pop-Location | ||
|
||
$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 |