Skip to content

Commit 24ab509

Browse files
build on linux arm64 (#3700)
* build on linux arm64 * Switch to ubuntu-22.04-arm https://github.com/actions/partner-runner-images * No Android emulator on linux-arm64 * Adapt scripts and targets * skip the maui test when NO_MOBILE=true more generic, applies to both linux-musl-x64 and linux-arm64 * add missing parentheses * changelog --------- Co-authored-by: J-P Nurmi <jpnurmi@gmail.com>
1 parent 19a8c7f commit 24ab509

File tree

10 files changed

+137
-13
lines changed

10 files changed

+137
-13
lines changed

.github/actions/environment/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ runs:
1111
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
1212
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
1313
14+
# Android SDK Tools are arm64-incompatible
1415
# Android SDK Build Tools are musl-incompatible
1516
- name: Set Environment Variables for Alpine Linux
16-
if: ${{ contains(matrix.container, 'alpine') }}
17+
if: ${{ (runner.os == 'Linux' && runner.arch == 'ARM64') || contains(matrix.container, 'alpine') }}
1718
shell: bash
1819
run: echo "NO_MOBILE=true" >> $GITHUB_ENV
1920

@@ -39,7 +40,7 @@ runs:
3940
java-version: '17'
4041

4142
- name: Setup Android SDK
42-
if: ${{ !matrix.container }}
43+
if: ${{ (runner.os != 'Linux' || runner.arch != 'ARM64') && !matrix.container }}
4344
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
4445
with:
4546
log-accepted-android-sdk-licenses: false

.github/workflows/build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
matrix:
2020
include:
2121
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
22+
- os: ubuntu-22.04-arm
23+
target: Linux-arm64
2224
- os: ubuntu-latest
2325
target: Linux-musl
2426
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
@@ -72,6 +74,9 @@ jobs:
7274
matrix:
7375
include:
7476
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
77+
target: Linux
78+
- os: ubuntu-22.04-arm
79+
target: Linux-arm64
7580
- os: ubuntu-latest
7681
target: Linux-musl
7782
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
@@ -104,13 +109,21 @@ jobs:
104109
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
105110

106111
- name: Download sentry-native (Linux)
107-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux' && !matrix.container) }}
112+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux') }}
108113
uses: actions/cache/restore@v4
109114
with:
110115
path: src/Sentry/Platforms/Native/sentry-native
111116
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
112117
fail-on-cache-miss: true
113118

119+
- name: Download sentry-native (Linux arm64)
120+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-arm64') }}
121+
uses: actions/cache/restore@v4
122+
with:
123+
path: src/Sentry/Platforms/Native/sentry-native
124+
key: sentry-native-Linux-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
125+
fail-on-cache-miss: true
126+
114127
- name: Download sentry-native (Linux musl)
115128
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-musl') }}
116129
uses: actions/cache/restore@v4
@@ -203,6 +216,7 @@ jobs:
203216
matrix:
204217
include:
205218
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
219+
- os: ubuntu-22.04-arm
206220
- os: ubuntu-latest
207221
container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
208222
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Fixes
66

7+
- Support Linux arm64 on Native AOT ([#3700](https://github.com/getsentry/sentry-dotnet/pull/3700))
78
- Revert W3C traceparent support ([#4204](https://github.com/getsentry/sentry-dotnet/pull/4204))
89

910
### Dependencies

Sentry-CI-Build-Linux-arm64.slnf

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"solution": {
3+
"path": "Sentry.sln",
4+
"projects": [
5+
"benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj",
6+
"samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj",
7+
"samples\\Sentry.Samples.AspNetCore.Blazor.Server\\Sentry.Samples.AspNetCore.Blazor.Server.csproj",
8+
"samples\\Sentry.Samples.AspNetCore.Blazor.Wasm\\Sentry.Samples.AspNetCore.Blazor.Wasm.csproj",
9+
"samples\\Sentry.Samples.AspNetCore.Grpc\\Sentry.Samples.AspNetCore.Grpc.csproj",
10+
"samples\\Sentry.Samples.AspNetCore.Mvc\\Sentry.Samples.AspNetCore.Mvc.csproj",
11+
"samples\\Sentry.Samples.AspNetCore.Serilog\\Sentry.Samples.AspNetCore.Serilog.csproj",
12+
"samples\\Sentry.Samples.AspNetCore.WebAPI.Profiling\\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj",
13+
"samples\\Sentry.Samples.Aws.Lambda.AspNetCoreServer\\Sentry.Samples.Aws.Lambda.AspNetCoreServer.csproj",
14+
"samples\\Sentry.Samples.Azure.Functions.Worker\\Sentry.Samples.Azure.Functions.Worker.csproj",
15+
"samples\\Sentry.Samples.Console.Basic\\Sentry.Samples.Console.Basic.csproj",
16+
"samples\\Sentry.Samples.Console.Customized\\Sentry.Samples.Console.Customized.csproj",
17+
"samples\\Sentry.Samples.Console.HeapDump\\Sentry.Samples.Console.HeapDump.csproj",
18+
"samples\\Sentry.Samples.Console.Native\\Sentry.Samples.Console.Native.csproj",
19+
"samples\\Sentry.Samples.Console.Profiling\\Sentry.Samples.Console.Profiling.csproj",
20+
"samples\\Sentry.Samples.EntityFramework\\Sentry.Samples.EntityFramework.csproj",
21+
"samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj",
22+
"samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj",
23+
"samples\\Sentry.Samples.GraphQL.Client.Http\\Sentry.Samples.GraphQL.Client.Http.csproj",
24+
"samples\\Sentry.Samples.GraphQL.Server\\Sentry.Samples.GraphQL.Server.csproj",
25+
"samples\\Sentry.Samples.Hangfire\\Sentry.Samples.Hangfire.csproj",
26+
"samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj",
27+
"samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj",
28+
"samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj",
29+
"samples\\Sentry.Samples.OpenTelemetry.AspNetCore\\Sentry.Samples.OpenTelemetry.AspNetCore.csproj",
30+
"samples\\Sentry.Samples.OpenTelemetry.Console\\Sentry.Samples.OpenTelemetry.Console.csproj",
31+
"samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj",
32+
"src\\Sentry.Analyzers\\Sentry.Analyzers.csproj",
33+
"src\\Sentry.AspNetCore.Blazor.WebAssembly\\Sentry.AspNetCore.Blazor.WebAssembly.csproj",
34+
"src\\Sentry.AspNetCore.Grpc\\Sentry.AspNetCore.Grpc.csproj",
35+
"src\\Sentry.AspNetCore\\Sentry.AspNetCore.csproj",
36+
"src\\Sentry.Azure.Functions.Worker\\Sentry.Azure.Functions.Worker.csproj",
37+
"src\\Sentry.DiagnosticSource\\Sentry.DiagnosticSource.csproj",
38+
"src\\Sentry.EntityFramework\\Sentry.EntityFramework.csproj",
39+
"src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj",
40+
"src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj",
41+
"src\\Sentry.Hangfire\\Sentry.Hangfire.csproj",
42+
"src\\Sentry.Log4Net\\Sentry.Log4Net.csproj",
43+
"src\\Sentry.NLog\\Sentry.NLog.csproj",
44+
"src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj",
45+
"src\\Sentry.Profiling\\Sentry.Profiling.csproj",
46+
"src\\Sentry.Serilog\\Sentry.Serilog.csproj",
47+
"src\\Sentry.SourceGenerators\\Sentry.SourceGenerators.csproj",
48+
"src\\Sentry\\Sentry.csproj",
49+
"test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj",
50+
"test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj",
51+
"test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj",
52+
"test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj",
53+
"test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj",
54+
"test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj",
55+
"test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj",
56+
"test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj",
57+
"test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj",
58+
"test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj",
59+
"test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj",
60+
"test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj",
61+
"test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj",
62+
"test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj",
63+
"test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj",
64+
"test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj",
65+
"test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj",
66+
"test\\Sentry.SourceGenerators.Tests\\Sentry.SourceGenerators.Tests.csproj",
67+
"test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj",
68+
"test\\Sentry.Testing\\Sentry.Testing.csproj",
69+
"test\\Sentry.Tests\\Sentry.Tests.csproj",
70+
"test\\SingleFileTestApp\\SingleFileTestApp.csproj"
71+
]
72+
}
73+
}

integration-test/cli.Tests.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Set-StrictMode -Version Latest
33
$ErrorActionPreference = 'Stop'
44
. $PSScriptRoot/common.ps1
5-
$IsLinuxMusl = $IsLinux -and (ldd --version 2>&1) -match 'musl'
65

76
Describe 'Console apps (<framework>) - normal build' -ForEach @(
87
@{ framework = "net8.0" }
@@ -108,7 +107,7 @@ Describe 'Console apps (<framework>) - native AOT publish' -ForEach @(
108107

109108
Describe 'MAUI' -ForEach @(
110109
@{ framework = "net8.0" }
111-
) -Skip:$IsLinuxMusl {
110+
) -Skip:($env:NO_MOBILE -eq "true") {
112111
BeforeAll {
113112
RegisterLocalPackage 'Sentry.Android.AssemblyReader'
114113
RegisterLocalPackage 'Sentry.Bindings.Android'

integration-test/runtime.Tests.ps1

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,20 @@ internal class FakeTransport : ITransport
5858
return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe"
5959
}
6060
}
61-
elseif ((ldd --version 2>&1) -match 'musl')
62-
{
63-
return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app"
64-
}
6561
else
6662
{
67-
return "./console-app/bin/Release/$framework/linux-x64/publish/console-app"
63+
if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()))
64+
{
65+
return "./console-app/bin/Release/$framework/linux-arm64/publish/console-app"
66+
}
67+
elseif ((ldd --version 2>&1) -match 'musl')
68+
{
69+
return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app"
70+
}
71+
else
72+
{
73+
return "./console-app/bin/Release/$framework/linux-x64/publish/console-app"
74+
}
6875
}
6976
}
7077

scripts/build-sentry-native.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ try
3737
}
3838
elseif ($IsLinux)
3939
{
40-
if ((ldd --version 2>&1) -match 'musl')
40+
if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()))
41+
{
42+
$outDir += '/linux-arm64'
43+
}
44+
elseif ((ldd --version 2>&1) -match 'musl')
4145
{
4246
$outDir += '/linux-musl-x64'
4347
}

scripts/generate-solution-filters-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ filterConfigs:
4949
- "**/*DeviceTests*.csproj"
5050
- "**/*Maui.Device.TestApp.csproj"
5151

52+
- outputPath: Sentry-CI-Build-Linux-arm64.slnf
53+
include:
54+
groups:
55+
- "allProjects"
56+
exclude:
57+
groups:
58+
- "macOnly"
59+
- "windowsOnly"
60+
- "artefacts"
61+
- "trimTests"
62+
patterns:
63+
- "**/*Android*.csproj"
64+
- "**/*DeviceTests*.csproj"
65+
- "**/*Maui*.csproj"
66+
5267
- outputPath: Sentry-CI-Build-Linux-musl.slnf
5368
include:
5469
groups:

src/Sentry/Platforms/Native/Sentry.Native.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
<SentryNativeOutputDirectory-linux-x64>$(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-x64)\</SentryNativeOutputDirectory-linux-x64>
1616
<NativeLibRelativePath-linux-musl-x64>linux-musl-x64</NativeLibRelativePath-linux-musl-x64>
1717
<SentryNativeOutputDirectory-linux-musl-x64>$(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-musl-x64)\</SentryNativeOutputDirectory-linux-musl-x64>
18+
<NativeLibRelativePath-linux-arm64>linux-arm64</NativeLibRelativePath-linux-arm64>
19+
<SentryNativeOutputDirectory-linux-arm64>$(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-arm64)\</SentryNativeOutputDirectory-linux-arm64>
1820
<NativeLibRelativePath-osx>osx</NativeLibRelativePath-osx>
1921
<SentryNativeOutputDirectory-osx>$(SentryNativeOutputDirectory)$(NativeLibRelativePath-osx)\</SentryNativeOutputDirectory-osx>
2022
<SentryNativeBuildOutputs Condition="'$(RuntimeIdentifier)' == 'win-x64'">$(SentryNativeOutputDirectory-win-x64)lib$(SentryNativeLibraryName).lib</SentryNativeBuildOutputs>
2123
<SentryNativeBuildOutputs Condition="'$(RuntimeIdentifier)' == 'win-arm64'">$(SentryNativeOutputDirectory-win-arm64)lib$(SentryNativeLibraryName).lib</SentryNativeBuildOutputs>
2224
<SentryNativeBuildOutputs Condition="'$(RuntimeIdentifier)' == 'linux-x64'">$(SentryNativeOutputDirectory-linux-x64)lib$(SentryNativeLibraryName).a</SentryNativeBuildOutputs>
2325
<SentryNativeBuildOutputs Condition="'$(RuntimeIdentifier)' == 'linux-musl-x64'">$(SentryNativeOutputDirectory-linux-musl-x64)lib$(SentryNativeLibraryName).a</SentryNativeBuildOutputs>
26+
<SentryNativeBuildOutputs Condition="'$(RuntimeIdentifier)' == 'linux-arm64'">$(SentryNativeOutputDirectory-linux-arm64)lib$(SentryNativeLibraryName).a</SentryNativeBuildOutputs>
2427
<SentryNativeBuildOutputs Condition="$([MSBuild]::IsOsPlatform('OSX'))">$(SentryNativeOutputDirectory-osx)lib$(SentryNativeLibraryName).a</SentryNativeBuildOutputs>
2528
</PropertyGroup>
2629

@@ -59,6 +62,13 @@
5962
</None>
6063
</ItemGroup>
6164

65+
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or '$(RuntimeIdentifier)' == 'linux-arm64'">
66+
<None Include="$(SentryNativeOutputDirectory-linux-arm64)lib$(SentryNativeLibraryName).a">
67+
<Pack>true</Pack>
68+
<PackagePath>\sentry-native\$(NativeLibRelativePath-linux-arm64)</PackagePath>
69+
</None>
70+
</ItemGroup>
71+
6272
<ItemGroup Condition="'$(CI_PUBLISHING_BUILD)' == 'true' or $([MSBuild]::IsOsPlatform('OSX'))">
6373
<None Include="$(SentryNativeOutputDirectory-osx)lib$(SentryNativeLibraryName).a">
6474
<Pack>true</Pack>

src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
<NativeLibrary Include="Gdi32.lib" />
3434
</ItemGroup>
3535

36-
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and '$(RuntimeIdentifier)' == 'linux-x64'">
36+
<ItemGroup Condition="'$(FrameworkSupportsNative)' == 'true' and ('$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64')">
3737
<DirectPInvoke Include="sentry-native" />
38-
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\linux-x64\libsentry-native.a" />
38+
<NativeLibrary Include="$(MSBuildThisFileDirectory)..\sentry-native\$(RuntimeIdentifier)\libsentry-native.a" />
3939
<!-- See: https://github.com/dotnet/runtime/issues/97414 -->
4040
<NativeSystemLibrary Include="curl" />
4141
</ItemGroup>

0 commit comments

Comments
 (0)