Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ jobs:
target: IOS
runsOn: ubuntu-latest

macos-sdk:
macos-cocoa-sdk:
uses: ./.github/workflows/sdk-download.yml
with:
target: Mac
backend: cocoa
runsOn: ubuntu-latest

macos-native-sdk:
uses: ./.github/workflows/sdk-build.yml
with:
target: Mac
backend: native
runsOn: macos-latest

linux-sdk-crashpad:
uses: ./.github/workflows/sdk-build.yml
with:
Expand Down Expand Up @@ -116,8 +124,15 @@ jobs:
runsOn: ubuntu-latest
runtimeId: linux-arm64

crash-reporter-mac:
uses: ./.github/workflows/crash-reporter-build.yml
with:
target: Mac
runsOn: macos-latest
runtimeId: osx-arm64

package-preparation:
needs: [android-sdk, ios-sdk, macos-sdk, linux-sdk-crashpad, linux-sdk-native, linux-arm64-sdk-crashpad, linux-arm64-sdk-native, windows-sdk-crashpad, windows-sdk-native, windows-arm64-sdk-crashpad, windows-arm64-sdk-native, crash-reporter-win64, crash-reporter-win-arm64, crash-reporter-linux, crash-reporter-linux-arm64]
needs: [android-sdk, ios-sdk, macos-cocoa-sdk, macos-native-sdk, linux-sdk-crashpad, linux-sdk-native, linux-arm64-sdk-crashpad, linux-arm64-sdk-native, windows-sdk-crashpad, windows-sdk-native, windows-arm64-sdk-crashpad, windows-arm64-sdk-native, crash-reporter-win64, crash-reporter-win-arm64, crash-reporter-linux, crash-reporter-linux-arm64, crash-reporter-mac]
name: Package
runs-on: ubuntu-latest
steps:
Expand All @@ -142,9 +157,14 @@ jobs:

- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: Mac-sdk
name: Mac-cocoa-sdk
path: plugin-dev/Source/ThirdParty/Mac

- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: Mac-native-sdk
path: plugin-dev/Source/ThirdParty/Mac/Native

- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: Linux-crashpad-sdk
Expand Down Expand Up @@ -205,6 +225,11 @@ jobs:
name: CrashReporter-LinuxArm64
path: plugin-dev/Source/ThirdParty/LinuxArm64

- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: CrashReporter-Mac
path: plugin-dev/Source/ThirdParty/Mac

# Workaround for https://github.com/actions/download-artifact/issues/14
# Adding execute permission for crashpad before preparing final packages
# allows to avoid issues with plugin initialization on Unix-based systems.
Expand All @@ -217,6 +242,8 @@ jobs:
chmod +x plugin-dev/Source/ThirdParty/LinuxArm64/Crashpad/bin/crashpad_handler
chmod +x plugin-dev/Source/ThirdParty/LinuxArm64/Native/bin/sentry-crash
chmod +x plugin-dev/Source/ThirdParty/LinuxArm64/Sentry.CrashReporter
chmod +x plugin-dev/Source/ThirdParty/Mac/Native/bin/sentry-crash
chmod +x plugin-dev/Source/ThirdParty/Mac/Sentry.CrashReporter

- name: Prepare Sentry packages for release
shell: pwsh
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/sdk-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
target:
required: true
type: string
backend:
required: false
type: string
default: ""

jobs:
download:
Expand All @@ -22,6 +26,7 @@ jobs:
id: env
env:
TARGET: ${{ inputs.target }}
BACKEND: ${{ inputs.backend }}
run: |
if [[ "$TARGET" == "IOS" || "$TARGET" == "Mac" ]]; then
echo "cacheLocation=modules/sentry-cocoa" >> $GITHUB_OUTPUT
Expand All @@ -30,6 +35,12 @@ jobs:
fi
echo "path=plugin-dev/Source/ThirdParty/$TARGET" >> $GITHUB_OUTPUT

if [[ -n "$BACKEND" ]]; then
echo "artifactName=${TARGET}-${BACKEND}-sdk" >> $GITHUB_OUTPUT
else
echo "artifactName=${TARGET}-sdk" >> $GITHUB_OUTPUT
fi

- uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: cache
with:
Expand All @@ -49,6 +60,6 @@ jobs:

- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: ${{ inputs.target }}-sdk
name: ${{ steps.env.outputs.artifactName }}
path: ${{ steps.env.outputs.path }}
retention-days: ${{ github.ref_name == 'main' && 14 || 1 }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- Add out-of-process screenshot capturing on Windows ([#1325](https://github.com/getsentry/sentry-unreal/pull/1325))
- Add native backend support for Mac ([#1333](https://github.com/getsentry/sentry-unreal/pull/1333))

### Fixes

Expand Down
37 changes: 22 additions & 15 deletions integration-test/Integration.Desktop.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@ BeforeDiscovery {
# Detect native backend by checking which crash handler binary exists in the packaged build
function Test-NativeBackend {
$appDir = Split-Path $env:SENTRY_UNREAL_TEST_APP_PATH
$pluginBinDir = Join-Path $appDir "SentryPlayground/Plugins/sentry/Binaries"
if ($IsMacOS) {
$pluginBinDir = Join-Path (Split-Path $appDir) "UE/SentryPlayground/Plugins/sentry/Binaries"
} else {
$pluginBinDir = Join-Path $appDir "SentryPlayground/Plugins/sentry/Binaries"
}
if ($IsWindows) {
return Test-Path (Join-Path $pluginBinDir "Win64/sentry-crash.exe")
} elseif ($IsLinux) {
return Test-Path (Join-Path $pluginBinDir "Linux/sentry-crash")
} elseif ($IsMacOS) {
return Test-Path (Join-Path $pluginBinDir "Mac/sentry-crash")
} else {
return $false
}
Expand All @@ -59,7 +65,7 @@ BeforeDiscovery {
$currentPlatform | Should -Not -Be $null
$TestTargets += Get-TestTarget -Platform $currentPlatform -ProviderName $currentPlatform

$IsNativeBackend = Test-NativeBackend
$script:IsNativeBackend = Test-NativeBackend

# Define crash types to test
$TestCrashTypes = @(
Expand All @@ -70,8 +76,8 @@ BeforeDiscovery {
@{ Name = 'OutOfMemory'; Arg = '-crash-oom'; Type = 'OutOfMemory' }
)

if ($IsLinux) {
# Memory overcommit makes OOM conditions unreliable to trigger in tests on Linux
if ($IsLinux -or ($IsMacOS -and $IsNativeBackend)) {
# Memory overcommit makes OOM conditions unreliable to trigger in tests on Linux and macOS with native backend
$TestCrashTypes = $TestCrashTypes | Where-Object { $_.Name -ne 'OutOfMemory' }
}
}
Expand Down Expand Up @@ -164,10 +170,11 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
# $crashTypeArg triggers specific crash type scenario in the sample app
$script:CrashResult = Invoke-DeviceApp -ExecutablePath $script:AppPath -Arguments ((@($crashTypeArg) + $appArgs) -join ' ')

# On macOS, the crash is captured but not uploaded immediately (due to Cocoa's behavior),
# On macOS with Cocoa backend, the crash is captured but not uploaded immediately,
# so we need to run the test app again to send it to Sentry.
# -init-only allows starting the app to flush captured events and quit right after
if ($Platform -eq 'MacOS') {
# -init-only allows starting the app to flush captured events and quit right after.
# With native backend, crashes are uploaded out-of-process so no relaunch is needed.
if ($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
Invoke-DeviceApp -ExecutablePath $script:AppPath -Arguments ((@('-init-only') + $appArgs) -join ' ')
}

Expand Down Expand Up @@ -211,7 +218,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa

It "Should have correct event type and platform" {
$script:CrashEvent.type | Should -Be 'error'
if ($Platform -eq 'MacOS') {
if ($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
$script:CrashEvent.platform | Should -Be 'cocoa'
}
else {
Expand Down Expand Up @@ -242,7 +249,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
($tags | Where-Object { $_.key -eq 'test.suite' }).value | Should -Be 'integration'
}

It "Should have CrashType tag" -Skip:($Name -in @('OutOfMemory', 'MemoryCorruption') -or $Platform -eq 'MacOS') {
It "Should have CrashType tag" -Skip:($Name -in @('OutOfMemory', 'MemoryCorruption') -or ($Platform -eq 'MacOS' -and -not $IsNativeBackend)) {
$tags = $script:CrashEvent.tags
($tags | Where-Object { $_.key -eq 'CrashType' }).value | Should -Be $Type
}
Expand Down Expand Up @@ -331,7 +338,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa

It "Should have correct event type and platform" {
$script:EnsureEvent.type | Should -Be 'error'
if ($Platform -eq 'MacOS') {
if ($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
$script:EnsureEvent.platform | Should -Be 'cocoa'
}
else {
Expand Down Expand Up @@ -365,7 +372,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
($tags | Where-Object { $_.key -eq 'test.suite' }).value | Should -Be 'integration'
}

It "Should have CrashType tag" -Skip:($Platform -eq 'MacOS') {
It "Should have CrashType tag" -Skip:($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
$tags = $script:EnsureEvent.tags
($tags | Where-Object { $_.key -eq 'CrashType' }).value | Should -Be 'Ensure'
}
Expand Down Expand Up @@ -538,7 +545,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
}

It "Should have correct platform" {
if ($Platform -eq 'MacOS') {
if ($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
$script:MessageEvent.platform | Should -Be 'cocoa'
}
else {
Expand All @@ -551,7 +558,7 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
$script:MessageEvent.message.formatted | Should -Match 'Integration test message'
}

It "Should have overridden release" -Skip:($Platform -eq 'MacOS') {
It "Should have overridden release" -Skip:($Platform -eq 'MacOS' -and -not $IsNativeBackend) {
$script:MessageEvent.release.version | Should -Be 'test-release@1.0.0'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the release formatted in a different way?

}

Expand Down Expand Up @@ -744,8 +751,8 @@ Describe "Sentry Unreal Desktop Integration Tests (<Platform>)" -ForEach $TestTa
}
}

# Metrics are not supported on Apple platforms (macOS/iOS)
Context "Metrics Capture Tests" -Skip:$IsMacOS {
# Metrics are not supported on macOS with Cocoa backend
Context "Metrics Capture Tests" -Skip:($IsMacOS -and -not $IsNativeBackend) {
BeforeAll {
$script:MetricResult = $null
$script:CapturedCounterMetrics = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "AppleSentryAttachment.h"

#if !USE_SENTRY_NATIVE

#include "Infrastructure/AppleSentryConverters.h"

#include "Convenience/AppleSentryInclude.h"
Expand Down Expand Up @@ -50,3 +52,5 @@ FString FAppleSentryAttachment::GetContentType() const
{
return FString(AttachmentApple.contentType);
}

#endif // !USE_SENTRY_NATIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#if !USE_SENTRY_NATIVE

#include "Interface/SentryAttachmentInterface.h"

@class SentryAttachment;
Expand All @@ -25,3 +27,5 @@ class FAppleSentryAttachment : public ISentryAttachment
};

typedef FAppleSentryAttachment FPlatformSentryAttachment;

#endif // !USE_SENTRY_NATIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "AppleSentryBreadcrumb.h"

#if !USE_SENTRY_NATIVE

#include "Infrastructure/AppleSentryConverters.h"

#include "Convenience/AppleSentryInclude.h"
Expand Down Expand Up @@ -76,3 +78,5 @@ ESentryLevel FAppleSentryBreadcrumb::GetLevel() const
{
return FAppleSentryConverters::SentryLevelToUnreal(BreadcrumbApple.level);
}

#endif // !USE_SENTRY_NATIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#if !USE_SENTRY_NATIVE

#include "Interface/SentryBreadcrumbInterface.h"

@class SentryBreadcrumb;
Expand Down Expand Up @@ -31,3 +33,5 @@ class FAppleSentryBreadcrumb : public ISentryBreadcrumb
};

typedef FAppleSentryBreadcrumb FPlatformSentryBreadcrumb;

#endif // !USE_SENTRY_NATIVE
5 changes: 5 additions & 0 deletions plugin-dev/Source/Sentry/Private/Apple/AppleSentryEvent.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) 2025 Sentry. All Rights Reserved.

#include "AppleSentryEvent.h"

#if !USE_SENTRY_NATIVE

#include "AppleSentryId.h"

#include "Infrastructure/AppleSentryConverters.h"
Expand Down Expand Up @@ -212,3 +215,5 @@ bool FAppleSentryEvent::IsAnr() const

return isErrorLevel && isAppHangException && isAppHangMechanism && isAppHangMessage;
}

#endif // !USE_SENTRY_NATIVE
4 changes: 4 additions & 0 deletions plugin-dev/Source/Sentry/Private/Apple/AppleSentryEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#if !USE_SENTRY_NATIVE

#include "Interface/SentryEventInterface.h"

@class SentryEvent;
Expand Down Expand Up @@ -46,3 +48,5 @@ class FAppleSentryEvent : public ISentryEvent
};

typedef FAppleSentryEvent FPlatformSentryEvent;

#endif // !USE_SENTRY_NATIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "AppleSentryFeedback.h"

#if !USE_SENTRY_NATIVE

#include "AppleSentryAttachment.h"
#include "AppleSentryId.h"

Expand Down Expand Up @@ -95,3 +97,5 @@ SentryFeedback* FAppleSentryFeedback::CreateSentryFeedback(TSharedPtr<FAppleSent
associatedEventId:id
attachments:attachments];
}

#endif // !USE_SENTRY_NATIVE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#pragma once

#if !USE_SENTRY_NATIVE

#include "Interface/SentryFeedbackInterface.h"

@class SentryFeedback;
Expand Down Expand Up @@ -32,4 +34,6 @@ class FAppleSentryFeedback : public ISentryFeedback
TArray<TSharedPtr<ISentryAttachment>> Attachments;
};

typedef FAppleSentryFeedback FPlatformSentryFeedback;
typedef FAppleSentryFeedback FPlatformSentryFeedback;

#endif // !USE_SENTRY_NATIVE
4 changes: 4 additions & 0 deletions plugin-dev/Source/Sentry/Private/Apple/AppleSentryId.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "AppleSentryId.h"

#if !USE_SENTRY_NATIVE

#include "Convenience/AppleSentryInclude.h"
#include "Convenience/AppleSentryMacro.h"

Expand Down Expand Up @@ -34,3 +36,5 @@ FString FAppleSentryId::ToString() const
{
return FString(IdApple.sentryIdString);
}

#endif // !USE_SENTRY_NATIVE
Loading
Loading