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 1cab070a6f..2bad323189 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ jobs: matrix: 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 @@ -72,6 +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 @@ -104,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 @@ -203,6 +216,7 @@ jobs: matrix: include: - os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed + - 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index aea4b547f4..cc97e73d36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Support Linux arm64 on Native AOT ([#3700](https://github.com/getsentry/sentry-dotnet/pull/3700)) - Revert W3C traceparent support ([#4204](https://github.com/getsentry/sentry-dotnet/pull/4204)) ### Dependencies 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/integration-test/cli.Tests.ps1 b/integration-test/cli.Tests.ps1 index d5ce17efdc..1a39cf541a 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' 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/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: 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 @@ - + - +