From bd5c0e0421533efc9fbfdc53636c8f44133bfdda Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Mon, 21 Oct 2024 20:32:37 -0400 Subject: [PATCH 1/7] build on linux arm64 --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d4d390647..fa96aea438 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu, windows, macos] + os: [ubuntu, windows, macos, ubuntu-latest-4-cores-arm64] steps: - name: Checkout @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-latest-4-cores-arm64] steps: - name: Cancel Previous Runs @@ -177,7 +177,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest, ubuntu-latest-4-cores-arm64] steps: - uses: actions/checkout@v4 From 7c683f2bc549d0da5154fff8b8fdc5c14ff0c8e9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 May 2025 10:33:38 +0200 Subject: [PATCH 2/7] Switch to ubuntu-22.04-arm https://github.com/actions/partner-runner-images --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 740f0e8e1f..5904a7fae9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: matrix: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed - - os: ubuntu-latest-4-cores-arm64 + - os: ubuntu-22.04-arm - os: ubuntu-latest target: Linux-musl container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 @@ -73,7 +73,7 @@ jobs: matrix: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed - - os: ubuntu-latest-4-cores-arm64 + - os: ubuntu-22.04-arm - os: ubuntu-latest target: Linux-musl container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 @@ -205,7 +205,7 @@ jobs: matrix: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed - - os: ubuntu-latest-4-cores-arm64 + - os: ubuntu-22.04-arm - os: ubuntu-latest container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 - os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703 From 120e51766dadf5ac6479059bf62a9adacc77ee2f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 May 2025 11:08:57 +0200 Subject: [PATCH 3/7] No Android emulator on linux-arm64 --- .github/actions/environment/action.yml | 5 +- .github/workflows/build.yml | 13 +++- Sentry-CI-Build-Linux-arm64.slnf | 73 +++++++++++++++++++ scripts/generate-solution-filters-config.yaml | 15 ++++ 4 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 Sentry-CI-Build-Linux-arm64.slnf diff --git a/.github/actions/environment/action.yml b/.github/actions/environment/action.yml index 0ab866f67b..79622656db 100644 --- a/.github/actions/environment/action.yml +++ b/.github/actions/environment/action.yml @@ -11,9 +11,10 @@ runs: echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV + # Android SDK Tools are arm64-incompatible # Android SDK Build Tools are musl-incompatible - name: Set Environment Variables for Alpine Linux - if: ${{ contains(matrix.container, 'alpine') }} + if: ${{ (runner.os == 'Linux' && runner.arch == 'ARM64') || contains(matrix.container, 'alpine') }} shell: bash run: echo "NO_MOBILE=true" >> $GITHUB_ENV @@ -39,7 +40,7 @@ runs: java-version: '17' - name: Setup Android SDK - if: ${{ !matrix.container }} + if: ${{ (runner.os != 'Linux' || runner.arch != 'ARM64') && !matrix.container }} uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0 with: log-accepted-android-sdk-licenses: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5904a7fae9..2bad323189 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,7 @@ jobs: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed - os: ubuntu-22.04-arm + target: Linux-arm64 - os: ubuntu-latest target: Linux-musl container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 @@ -73,7 +74,9 @@ jobs: matrix: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed + target: Linux - os: ubuntu-22.04-arm + target: Linux-arm64 - os: ubuntu-latest target: Linux-musl container: ghcr.io/getsentry/sentry-dotnet-alpine:3.21 @@ -106,13 +109,21 @@ jobs: run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV - name: Download sentry-native (Linux) - if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux' && !matrix.container) }} + if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux') }} uses: actions/cache/restore@v4 with: path: src/Sentry/Platforms/Native/sentry-native key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }} fail-on-cache-miss: true + - name: Download sentry-native (Linux arm64) + if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-arm64') }} + uses: actions/cache/restore@v4 + with: + path: src/Sentry/Platforms/Native/sentry-native + key: sentry-native-Linux-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }} + fail-on-cache-miss: true + - name: Download sentry-native (Linux musl) if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-musl') }} uses: actions/cache/restore@v4 diff --git a/Sentry-CI-Build-Linux-arm64.slnf b/Sentry-CI-Build-Linux-arm64.slnf new file mode 100644 index 0000000000..9d305e5df8 --- /dev/null +++ b/Sentry-CI-Build-Linux-arm64.slnf @@ -0,0 +1,73 @@ +{ + "solution": { + "path": "Sentry.sln", + "projects": [ + "benchmarks\\Sentry.Benchmarks\\Sentry.Benchmarks.csproj", + "samples\\Sentry.Samples.AspNetCore.Basic\\Sentry.Samples.AspNetCore.Basic.csproj", + "samples\\Sentry.Samples.AspNetCore.Blazor.Server\\Sentry.Samples.AspNetCore.Blazor.Server.csproj", + "samples\\Sentry.Samples.AspNetCore.Blazor.Wasm\\Sentry.Samples.AspNetCore.Blazor.Wasm.csproj", + "samples\\Sentry.Samples.AspNetCore.Grpc\\Sentry.Samples.AspNetCore.Grpc.csproj", + "samples\\Sentry.Samples.AspNetCore.Mvc\\Sentry.Samples.AspNetCore.Mvc.csproj", + "samples\\Sentry.Samples.AspNetCore.Serilog\\Sentry.Samples.AspNetCore.Serilog.csproj", + "samples\\Sentry.Samples.AspNetCore.WebAPI.Profiling\\Sentry.Samples.AspNetCore.WebAPI.Profiling.csproj", + "samples\\Sentry.Samples.Aws.Lambda.AspNetCoreServer\\Sentry.Samples.Aws.Lambda.AspNetCoreServer.csproj", + "samples\\Sentry.Samples.Azure.Functions.Worker\\Sentry.Samples.Azure.Functions.Worker.csproj", + "samples\\Sentry.Samples.Console.Basic\\Sentry.Samples.Console.Basic.csproj", + "samples\\Sentry.Samples.Console.Customized\\Sentry.Samples.Console.Customized.csproj", + "samples\\Sentry.Samples.Console.HeapDump\\Sentry.Samples.Console.HeapDump.csproj", + "samples\\Sentry.Samples.Console.Native\\Sentry.Samples.Console.Native.csproj", + "samples\\Sentry.Samples.Console.Profiling\\Sentry.Samples.Console.Profiling.csproj", + "samples\\Sentry.Samples.EntityFramework\\Sentry.Samples.EntityFramework.csproj", + "samples\\Sentry.Samples.GenericHost\\Sentry.Samples.GenericHost.csproj", + "samples\\Sentry.Samples.Google.Cloud.Functions\\Sentry.Samples.Google.Cloud.Functions.csproj", + "samples\\Sentry.Samples.GraphQL.Client.Http\\Sentry.Samples.GraphQL.Client.Http.csproj", + "samples\\Sentry.Samples.GraphQL.Server\\Sentry.Samples.GraphQL.Server.csproj", + "samples\\Sentry.Samples.Hangfire\\Sentry.Samples.Hangfire.csproj", + "samples\\Sentry.Samples.Log4Net\\Sentry.Samples.Log4Net.csproj", + "samples\\Sentry.Samples.ME.Logging\\Sentry.Samples.ME.Logging.csproj", + "samples\\Sentry.Samples.NLog\\Sentry.Samples.NLog.csproj", + "samples\\Sentry.Samples.OpenTelemetry.AspNetCore\\Sentry.Samples.OpenTelemetry.AspNetCore.csproj", + "samples\\Sentry.Samples.OpenTelemetry.Console\\Sentry.Samples.OpenTelemetry.Console.csproj", + "samples\\Sentry.Samples.Serilog\\Sentry.Samples.Serilog.csproj", + "src\\Sentry.Analyzers\\Sentry.Analyzers.csproj", + "src\\Sentry.AspNetCore.Blazor.WebAssembly\\Sentry.AspNetCore.Blazor.WebAssembly.csproj", + "src\\Sentry.AspNetCore.Grpc\\Sentry.AspNetCore.Grpc.csproj", + "src\\Sentry.AspNetCore\\Sentry.AspNetCore.csproj", + "src\\Sentry.Azure.Functions.Worker\\Sentry.Azure.Functions.Worker.csproj", + "src\\Sentry.DiagnosticSource\\Sentry.DiagnosticSource.csproj", + "src\\Sentry.EntityFramework\\Sentry.EntityFramework.csproj", + "src\\Sentry.Extensions.Logging\\Sentry.Extensions.Logging.csproj", + "src\\Sentry.Google.Cloud.Functions\\Sentry.Google.Cloud.Functions.csproj", + "src\\Sentry.Hangfire\\Sentry.Hangfire.csproj", + "src\\Sentry.Log4Net\\Sentry.Log4Net.csproj", + "src\\Sentry.NLog\\Sentry.NLog.csproj", + "src\\Sentry.OpenTelemetry\\Sentry.OpenTelemetry.csproj", + "src\\Sentry.Profiling\\Sentry.Profiling.csproj", + "src\\Sentry.Serilog\\Sentry.Serilog.csproj", + "src\\Sentry.SourceGenerators\\Sentry.SourceGenerators.csproj", + "src\\Sentry\\Sentry.csproj", + "test\\Sentry.Analyzers.Tests\\Sentry.Analyzers.Tests.csproj", + "test\\Sentry.AspNet.Tests\\Sentry.AspNet.Tests.csproj", + "test\\Sentry.AspNetCore.Grpc.Tests\\Sentry.AspNetCore.Grpc.Tests.csproj", + "test\\Sentry.AspNetCore.Tests\\Sentry.AspNetCore.Tests.csproj", + "test\\Sentry.AspNetCore.TestUtils\\Sentry.AspNetCore.TestUtils.csproj", + "test\\Sentry.Azure.Functions.Worker.Tests\\Sentry.Azure.Functions.Worker.Tests.csproj", + "test\\Sentry.DiagnosticSource.IntegrationTests\\Sentry.DiagnosticSource.IntegrationTests.csproj", + "test\\Sentry.DiagnosticSource.Tests\\Sentry.DiagnosticSource.Tests.csproj", + "test\\Sentry.EntityFramework.Tests\\Sentry.EntityFramework.Tests.csproj", + "test\\Sentry.Extensions.Logging.Tests\\Sentry.Extensions.Logging.Tests.csproj", + "test\\Sentry.Google.Cloud.Functions.Tests\\Sentry.Google.Cloud.Functions.Tests.csproj", + "test\\Sentry.Hangfire.Tests\\Sentry.Hangfire.Tests.csproj", + "test\\Sentry.Log4Net.Tests\\Sentry.Log4Net.Tests.csproj", + "test\\Sentry.NLog.Tests\\Sentry.NLog.Tests.csproj", + "test\\Sentry.OpenTelemetry.Tests\\Sentry.OpenTelemetry.Tests.csproj", + "test\\Sentry.Profiling.Tests\\Sentry.Profiling.Tests.csproj", + "test\\Sentry.Serilog.Tests\\Sentry.Serilog.Tests.csproj", + "test\\Sentry.SourceGenerators.Tests\\Sentry.SourceGenerators.Tests.csproj", + "test\\Sentry.Testing.CrashableApp\\Sentry.Testing.CrashableApp.csproj", + "test\\Sentry.Testing\\Sentry.Testing.csproj", + "test\\Sentry.Tests\\Sentry.Tests.csproj", + "test\\SingleFileTestApp\\SingleFileTestApp.csproj" + ] + } +} diff --git a/scripts/generate-solution-filters-config.yaml b/scripts/generate-solution-filters-config.yaml index 25752d7765..8f54c4bb8d 100644 --- a/scripts/generate-solution-filters-config.yaml +++ b/scripts/generate-solution-filters-config.yaml @@ -49,6 +49,21 @@ filterConfigs: - "**/*DeviceTests*.csproj" - "**/*Maui.Device.TestApp.csproj" + - outputPath: Sentry-CI-Build-Linux-arm64.slnf + include: + groups: + - "allProjects" + exclude: + groups: + - "macOnly" + - "windowsOnly" + - "artefacts" + - "trimTests" + patterns: + - "**/*Android*.csproj" + - "**/*DeviceTests*.csproj" + - "**/*Maui*.csproj" + - outputPath: Sentry-CI-Build-Linux-musl.slnf include: groups: From 4fde22799b45b9cbfc74dccfa7abca5396952f9e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 May 2025 12:47:37 +0200 Subject: [PATCH 4/7] Adapt scripts and targets --- integration-test/runtime.Tests.ps1 | 17 ++++++++++++----- scripts/build-sentry-native.ps1 | 6 +++++- .../Platforms/Native/Sentry.Native.targets | 10 ++++++++++ .../buildTransitive/Sentry.Native.targets | 4 ++-- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/integration-test/runtime.Tests.ps1 b/integration-test/runtime.Tests.ps1 index 9f22d10cb4..c8a0a55e15 100644 --- a/integration-test/runtime.Tests.ps1 +++ b/integration-test/runtime.Tests.ps1 @@ -58,13 +58,20 @@ internal class FakeTransport : ITransport return "./console-app/bin/Release/$framework/win-x64/publish/console-app.exe" } } - elseif ((ldd --version 2>&1) -match 'musl') - { - return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app" - } else { - return "./console-app/bin/Release/$framework/linux-x64/publish/console-app" + if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + { + return "./console-app/bin/Release/$framework/linux-arm64/publish/console-app" + } + elseif ((ldd --version 2>&1) -match 'musl') + { + return "./console-app/bin/Release/$framework/linux-musl-x64/publish/console-app" + } + else + { + return "./console-app/bin/Release/$framework/linux-x64/publish/console-app" + } } } diff --git a/scripts/build-sentry-native.ps1 b/scripts/build-sentry-native.ps1 index 50f58439f8..a11e033b2c 100644 --- a/scripts/build-sentry-native.ps1 +++ b/scripts/build-sentry-native.ps1 @@ -37,7 +37,11 @@ try } elseif ($IsLinux) { - if ((ldd --version 2>&1) -match 'musl') + if ("Arm64".Equals([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())) + { + $outDir += '/linux-arm64' + } + elseif ((ldd --version 2>&1) -match 'musl') { $outDir += '/linux-musl-x64' } diff --git a/src/Sentry/Platforms/Native/Sentry.Native.targets b/src/Sentry/Platforms/Native/Sentry.Native.targets index a3b365ef90..e485553ed5 100644 --- a/src/Sentry/Platforms/Native/Sentry.Native.targets +++ b/src/Sentry/Platforms/Native/Sentry.Native.targets @@ -15,12 +15,15 @@ $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-x64)\ linux-musl-x64 $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-musl-x64)\ + linux-arm64 + $(SentryNativeOutputDirectory)$(NativeLibRelativePath-linux-arm64)\ osx $(SentryNativeOutputDirectory)$(NativeLibRelativePath-osx)\ $(SentryNativeOutputDirectory-win-x64)lib$(SentryNativeLibraryName).lib $(SentryNativeOutputDirectory-win-arm64)lib$(SentryNativeLibraryName).lib $(SentryNativeOutputDirectory-linux-x64)lib$(SentryNativeLibraryName).a $(SentryNativeOutputDirectory-linux-musl-x64)lib$(SentryNativeLibraryName).a + $(SentryNativeOutputDirectory-linux-arm64)lib$(SentryNativeLibraryName).a $(SentryNativeOutputDirectory-osx)lib$(SentryNativeLibraryName).a @@ -59,6 +62,13 @@ + + + true + \sentry-native\$(NativeLibRelativePath-linux-arm64) + + + true diff --git a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets index 90ccbdc0d6..ea1fd7584e 100644 --- a/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets +++ b/src/Sentry/Platforms/Native/buildTransitive/Sentry.Native.targets @@ -33,9 +33,9 @@ - + - + From ae77993ce063da929ee4391a0c5516fb2313e966 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 May 2025 13:55:44 +0200 Subject: [PATCH 5/7] skip the maui test when NO_MOBILE=true more generic, applies to both linux-musl-x64 and linux-arm64 --- integration-test/cli.Tests.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/integration-test/cli.Tests.ps1 b/integration-test/cli.Tests.ps1 index d5ce17efdc..564d6cf2b2 100644 --- a/integration-test/cli.Tests.ps1 +++ b/integration-test/cli.Tests.ps1 @@ -2,7 +2,6 @@ Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' . $PSScriptRoot/common.ps1 -$IsLinuxMusl = $IsLinux -and (ldd --version 2>&1) -match 'musl' Describe 'Console apps () - normal build' -ForEach @( @{ framework = "net8.0" } @@ -108,7 +107,7 @@ Describe 'Console apps () - native AOT publish' -ForEach @( Describe 'MAUI' -ForEach @( @{ framework = "net8.0" } -) -Skip:$IsLinuxMusl { +) -Skip:$env:NO_MOBILE -eq "true" { BeforeAll { RegisterLocalPackage 'Sentry.Android.AssemblyReader' RegisterLocalPackage 'Sentry.Bindings.Android' From 30b92d84a43b0a2ce568f1400e18afb0b8ab671f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 28 May 2025 15:00:37 +0200 Subject: [PATCH 6/7] add missing parentheses --- integration-test/cli.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-test/cli.Tests.ps1 b/integration-test/cli.Tests.ps1 index 564d6cf2b2..1a39cf541a 100644 --- a/integration-test/cli.Tests.ps1 +++ b/integration-test/cli.Tests.ps1 @@ -107,7 +107,7 @@ Describe 'Console apps () - native AOT publish' -ForEach @( Describe 'MAUI' -ForEach @( @{ framework = "net8.0" } -) -Skip:$env:NO_MOBILE -eq "true" { +) -Skip:($env:NO_MOBILE -eq "true") { BeforeAll { RegisterLocalPackage 'Sentry.Android.AssemblyReader' RegisterLocalPackage 'Sentry.Bindings.Android' From b6994404951429f5fad1022f1bdaa33a1fafd453 Mon Sep 17 00:00:00 2001 From: Bruno Garcia Date: Wed, 28 May 2025 15:04:24 -0400 Subject: [PATCH 7/7] changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6408973d3..d7c8696f07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,17 @@ # Changelog +## Unreleased + +### Fixes + +- Support Linux arm64 on Native AOT ([#3700](https://github.com/getsentry/sentry-dotnet/pull/3700)) + ## 5.8.1 ### Fixes - Revert W3C traceparent support ([#4204](https://github.com/getsentry/sentry-dotnet/pull/4204)) -- Support musl on Linux ([#4188](https://github.com/getsentry/sentry-dotnet/pull/4188)) +- Support musl on Linux on Native AOT ([#4188](https://github.com/getsentry/sentry-dotnet/pull/4188)) - Support for Windows ARM64 with Native AOT ([#4187](https://github.com/getsentry/sentry-dotnet/pull/4187)) - Addressed potential performance issue with Sentry.Maui ([#4219](https://github.com/getsentry/sentry-dotnet/pull/4219)) - Respect `SentryNative=false` at runtime ([#4220](https://github.com/getsentry/sentry-dotnet/pull/4220))