-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AOT] Added AotCompatibility testApp and added CI to test AOT compati…
…bility. (#1296)
- Loading branch information
Showing
5 changed files
with
116 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,30 @@ | ||
name: Publish AOTCompatibility testApp | ||
|
||
on: | ||
push: | ||
branches: [ 'main*' ] | ||
paths: | ||
- 'src/OpenTelemetry.Instrumentation.Runtime/**' | ||
- '!src/OpenTelemetry.Instrumentation.Runtime/README.md' | ||
pull_request: | ||
branches: [ 'main*' ] | ||
paths: | ||
- 'src/OpenTelemetry.Instrumentation.Runtime/**' | ||
- '!src/OpenTelemetry.Instrumentation.Runtime/README.md' | ||
|
||
jobs: | ||
aot-test: | ||
strategy: | ||
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
version: [ net7.0 ] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: publish AOT testApp, assert static analysis warning count, and run the app | ||
shell: pwsh | ||
run: .\build\test-aot-compatibility.ps1 ${{ matrix.version }} | ||
|
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,40 @@ | ||
param([string]$targetNetFramework) | ||
|
||
$rootDirectory = Split-Path $PSScriptRoot -Parent | ||
$publishOutput = dotnet publish $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj -nodeReuse:false /p:UseSharedCompilation=false | ||
|
||
$actualWarningCount = 0 | ||
|
||
foreach ($line in $($publishOutput -split "`r`n")) | ||
{ | ||
if ($line -like "*analysis warning IL*") | ||
{ | ||
Write-Host $line | ||
$actualWarningCount += 1 | ||
} | ||
} | ||
|
||
Write-Host "Actual warning count is:", $actualWarningCount | ||
$expectedWarningCount = 0 | ||
|
||
pushd $rootDirectory/test/OpenTelemetry.AotCompatibility.TestApp/bin/Debug/$targetNetFramework/linux-x64 | ||
|
||
Write-Host "Executing test App..." | ||
./OpenTelemetry.AotCompatibility.TestApp | ||
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 | ||
|
||
$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 |
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
18 changes: 18 additions & 0 deletions
18
test/OpenTelemetry.AotCompatibility.TestApp/OpenTelemetry.AotCompatibility.TestApp.csproj
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,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<PublishAot Condition="!$([MSBuild]::IsOSPlatform('OSX'))">true</PublishAot> | ||
<TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
<SelfContained>true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootAssembly Include="OpenTelemetry.Instrumentation.Runtime" /> | ||
|
||
<TrimmerRootAssembly Update="@(TrimmerRootAssembly)" Path="$(RepoRoot)\src\%(Identity)\%(Identity).csproj" /> | ||
<ProjectReference Include="@(TrimmerRootAssembly->'%(Path)')" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,19 @@ | ||
// <copyright file="Program.cs" company="OpenTelemetry Authors"> | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// </copyright> | ||
|
||
using System; | ||
|
||
Console.WriteLine("Hello, World!"); |