Skip to content
Open
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
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,10 @@ jobs:
unity-version: ${{ matrix.unity-version }}

smoke-test-run-android:
name: Run Android ${{ matrix.unity-version }} Smoke Test
name: Run Android ${{ matrix.unity-version }} Integration Test
if: ${{ !startsWith(github.ref, 'refs/heads/release/') }}
needs: [smoke-test-build-android, create-unity-matrix]
secrets: inherit
uses: ./.github/workflows/smoke-test-run-android.yml
with:
unity-version: ${{ matrix.unity-version }}
Expand All @@ -270,8 +271,10 @@ jobs:
fail-fast: false
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
api-level: [30, 31, 34]
init-type: ["runtime", "buildtime"]
# api-level: [30, 31, 34]
api-level: [30]
# init-type: ["runtime", "buildtime"]
init-type: ["runtime"]

smoke-test-build-ios:
name: Build iOS ${{ matrix.unity-version }} Smoke Test
Expand Down
35 changes: 19 additions & 16 deletions .github/workflows/smoke-test-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ jobs:
run: ./test/Scripts.Integration.Test/add-sentry.ps1 -UnityPath "$env:UNITY_PATH" -PackagePath "test-package-release"

- name: Configure Sentry
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols
run: ./test/Scripts.Integration.Test/configure-sentry.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols -TestMode "integration"
env:
SENTRY_DSN: ${{ secrets.SENTRY_TEST_DSN }}

- name: Export APK - Runtime Initialization
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$true -UnityVersion "$env:UNITY_VERSION"
Expand All @@ -99,23 +101,24 @@ jobs:
path: samples/IntegrationTest/Build/*.apk # Collect app but ignore the files that are not required for the test.
retention-days: 14 # Lower retention period - we only need this to retry CI.

- name: Overwrite OptionsConfiguration for build-time initialization
run: |
$optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs"
$content = Get-Content $optionsPath -Raw
$content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime'
Set-Content $optionsPath $content
# TODO: Get this back in
# - name: Overwrite OptionsConfiguration for build-time initialization
# run: |
# $optionsPath = "samples/IntegrationTest/Assets/Scripts/OptionsConfiguration.cs"
# $content = Get-Content $optionsPath -Raw
# $content = $content -replace 'AndroidNativeInitializationType = NativeInitializationType.Runtime', 'AndroidNativeInitializationType = NativeInitializationType.BuildTime'
# Set-Content $optionsPath $content

- name: Export APK - Build-Time Initialization
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$true -UnityVersion "$env:UNITY_VERSION"
# - name: Export APK - Build-Time Initialization
# run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "Android" -CheckSymbols:$true -UnityVersion "$env:UNITY_VERSION"

# - name: Upload .apk
# uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
# with:
# name: testapp-android-compiled-${{ env.UNITY_VERSION }}-buildtime
# path: samples/IntegrationTest/Build/*.apk # Collect app but ignore the files that are not required for the test.
# retention-days: 14 # Lower retention period - we only need this to retry CI.

- name: Upload .apk
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: testapp-android-compiled-${{ env.UNITY_VERSION }}-buildtime
path: samples/IntegrationTest/Build/*.apk # Collect app but ignore the files that are not required for the test.
retention-days: 14 # Lower retention period - we only need this to retry CI.

- name: Upload IntegrationTest project on failure
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/smoke-test-run-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
# Map the workflow outputs to job outputs
outputs:
status:
description: "Smoke test status"
description: "Integration test status"
value: ${{ jobs.run.outputs.status }}

defaults:
Expand All @@ -28,14 +28,23 @@ jobs:
env:
ARTIFACTS_PATH: samples/IntegrationTest/test-artifacts/
HOMEBREW_NO_INSTALL_CLEANUP: 1
SENTRY_TEST_DSN: ${{ secrets.SENTRY_TEST_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# Map the job outputs to step outputs
outputs:
status: ${{ steps.smoke-test.outputs.status }}
status: ${{ steps.integration-test.outputs.status }}

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4


- name: Initialize app-runner submodule
run: git submodule update --init modules/app-runner
shell: bash

- name: Install Pester
run: Install-Module -Name Pester -Force -SkipPublisherCheck

- name: Download test app artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
Expand All @@ -56,9 +65,16 @@ jobs:
mkdir -p $HOME/.android/avd
touch $HOME/.android/repositories.cfg

- name: Run Android Smoke Tests
- name: Add Android build-tools to PATH
run: |
BUILD_TOOLS_DIR=$(ls -d $ANDROID_HOME/build-tools/*/ | sort -V | tail -1)
echo "Found build-tools at: $BUILD_TOOLS_DIR"
echo "$BUILD_TOOLS_DIR" >> $GITHUB_PATH
shell: bash

- name: Run Android Integration Tests
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v2.33.0
id: smoke-test
id: integration-test
timeout-minutes: 30
with:
api-level: ${{ inputs.api-level }}
Expand All @@ -81,12 +97,14 @@ jobs:
adb wait-for-device
adb shell input keyevent 82
adb devices -l
pwsh ./scripts/smoke-test-android.ps1 -WarnIfFlaky
pwsh -Command '$env:SENTRY_TEST_APK = "samples/IntegrationTest/Build/test.apk"; Invoke-Pester -Script test/IntegrationTest/Integration.Tests.ps1 -CI'
Copy link

Choose a reason for hiding this comment

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

Pester -Script and -CI parameter set conflict

High Severity

The Invoke-Pester command uses -Script (from the deprecated Legacy parameter set) together with -CI (from the Simple/Default parameter set). In Pester v5, these belong to different parameter sets and PowerShell does not allow combining parameters from different sets. This will cause a parameter binding error, preventing the integration tests from running. The -Script parameter needs to be replaced with -Path, which is in the same Simple parameter set as -CI.

Fix in Cursor Fix in Web


- name: Upload artifacts on failure
- name: Upload test results on failure
if: ${{ failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: testapp-android-logs-${{ inputs.api-level }}-${{ inputs.unity-version }}
path: ${{ env.ARTIFACTS_PATH }}
retention-days: 14
path: |
${{ env.ARTIFACTS_PATH }}
test/IntegrationTest/results/
retention-days: 14
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "modules/sentry-native"]
path = modules/sentry-native
url = https://github.com/getsentry/sentry-native.git
[submodule "modules/app-runner"]
path = modules/app-runner
url = https://github.com/getsentry/app-runner.git
1 change: 1 addition & 0 deletions modules/app-runner
Submodule app-runner added at 0f3a63
1 change: 1 addition & 0 deletions src/Sentry.Unity.Android/SentryJava.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void Init(SentryUnityOptions options)
androidOptions.Call("setDsn", options.Dsn);
androidOptions.Call("setDebug", options.Debug);
androidOptions.Call("setRelease", options.Release);
androidOptions.Call("setDist", options.Distribution);
androidOptions.Call("setEnvironment", options.Environment);

var sentryLevelClass = new AndroidJavaClass("io.sentry.SentryLevel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ internal void ModifyManifest(string basePath)
androidManifest.SetRelease(_options.Release);
}

if (_options.Distribution is not null)
{
_logger.LogDebug("Setting Dist: {0}", _options.Distribution);
androidManifest.SetDist(_options.Distribution);
}

if (_options.Environment is not null)
{
_logger.LogDebug("Setting Environment: {0}", _options.Environment);
Expand Down Expand Up @@ -469,6 +475,8 @@ internal void SetSampleRate(float sampleRate) =>

internal void SetRelease(string release) => SetMetaData($"{SentryPrefix}.release", release);

internal void SetDist(string dist) => SetMetaData($"{SentryPrefix}.dist", dist);

internal void SetAttachScreenshot(bool value) => SetMetaData($"{SentryPrefix}.attach-screenshot", value.ToString());

internal void SetEnvironment(string environment) => SetMetaData($"{SentryPrefix}.environment", environment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ private static void ConfigureOptions(Dictionary<string, string> args, [CallerMem
OptionsConfigurationItem.SetScript(value);
}

if (args.TryGetValue("dsn", out value))
{
Debug.LogFormat("{0}: Setting DSN", functionName);
options.Dsn = value;
}

optionsWindow.Close();
Debug.LogFormat("{0}: SUCCESS", functionName);
}
Expand Down
2 changes: 1 addition & 1 deletion src/sentry-dotnet
Submodule sentry-dotnet updated 68 files
+0 −1,461 .generated.NoMobile.sln
+184 −0 .generated.NoMobile.slnx
+1 −0 .gitattributes
+1 −1 .github/actions/buildnative/action.yml
+1 −1 .github/workflows/alpine.yml
+6 −5 .github/workflows/build.yml
+1 −1 .github/workflows/changelog-preview.yml
+2 −2 .github/workflows/codeql-analysis.yml
+1 −1 .github/workflows/danger.yml
+42 −2 .github/workflows/device-tests-android.yml
+44 −4 .github/workflows/device-tests-ios.yml
+8 −4 .github/workflows/format-code.yml
+1 −1 .github/workflows/release.yml
+1 −1 .github/workflows/update-deps.yml
+2 −2 .github/workflows/vulnerabilities.yml
+1 −1 .vscode/settings.json
+11 −0 CHANGELOG.md
+2 −2 CONTRIBUTING.md
+2 −2 Directory.Build.props
+1 −1 Directory.Build.targets
+2 −1 Sentry-CI-Build-Linux-NoMobile.slnf
+2 −1 Sentry-CI-Build-Linux.slnf
+2 −1 Sentry-CI-Build-Windows-arm64.slnf
+2 −1 Sentry-CI-Build-Windows.slnf
+2 −1 Sentry-CI-Build-macOS.slnf
+1 −1 Sentry-CI-CodeQL.slnf
+0 −1,462 Sentry.sln
+184 −0 Sentry.slnx
+2 −1 SentryAspNetCore.slnf
+1 −1 SentryCore.slnf
+1 −1 SentryDiagnosticSource.slnf
+1 −1 SentryMobile.slnf
+2 −1 SentryNoMobile.slnf
+2 −1 SentryNoSamples.slnf
+2 −2 build.cmd
+2 −2 build.sh
+1 −1 integration-test/android.Tests.ps1
+ lib/sentrysupplemental/bin/arm64-v8a/libsentrysupplemental.so
+ lib/sentrysupplemental/bin/armeabi-v7a/libsentrysupplemental.so
+ lib/sentrysupplemental/bin/x86/libsentrysupplemental.so
+ lib/sentrysupplemental/bin/x86_64/libsentrysupplemental.so
+3 −1 lib/sentrysupplemental/sentrysupplemental.c
+1 −1 modules/sentry-cocoa.properties
+1 −1 modules/sentry-native
+1 −1 samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj
+2 −2 scripts/generate-cocoa-bindings.ps1
+8 −8 scripts/generate-solution-filters-config.yaml
+60 −10 scripts/patch-cocoa-bindings.cs
+78 −0 src/Sentry.AspNetCore.Blazor.WebAssembly/Internal/BlazorWasmOptionsSetup.cs
+4 −0 src/Sentry.AspNetCore.Blazor.WebAssembly/Sentry.AspNetCore.Blazor.WebAssembly.csproj
+5 −0 src/Sentry.AspNetCore.Blazor.WebAssembly/WebAssemblyHostBuilderExtensions.cs
+9 −3 src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
+1 −3 src/Sentry.Bindings.Android/Transforms/Metadata.xml
+1,514 −1,515 src/Sentry.Bindings.Cocoa/ApiDefinitions.cs
+30 −15 src/Sentry.Bindings.Cocoa/StructsAndEnums.cs
+1 −1 src/Sentry.Maui.CommunityToolkit.Mvvm/Sentry.Maui.CommunityToolkit.Mvvm.csproj
+6 −1 src/Sentry/Internal/AotHelper.cs
+2 −0 src/Sentry/Platforms/Cocoa/BindableSentryOptions.cs
+1 −1 src/Sentry/Platforms/Cocoa/CFunctions.cs
+1 −0 src/Sentry/Platforms/Cocoa/Sentry.Cocoa.props
+4 −4 src/Sentry/Platforms/Cocoa/SentryOptions.cs
+4 −4 src/Sentry/Platforms/Cocoa/SentrySdk.cs
+1 −0 src/Sentry/Sentry.csproj
+164 −0 test/Sentry.AspNetCore.Blazor.WebAssembly.Tests/BlazorWasmOptionsSetupTests.cs
+18 −0 test/Sentry.AspNetCore.Blazor.WebAssembly.Tests/FakeNavigationManager.cs
+12 −0 test/Sentry.AspNetCore.Blazor.WebAssembly.Tests/Sentry.AspNetCore.Blazor.WebAssembly.Tests.csproj
+1 −1 test/Sentry.Maui.Device.TestApp/Sentry.Maui.Device.TestApp.csproj
+1 −0 test/Sentry.Testing/Sentry.Testing.csproj
131 changes: 131 additions & 0 deletions test/IntegrationTest/CommonTestCases.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Defines a collection of reusable test cases that validate common Sentry event properties
# and behaviors across different test suites for consistent integration testing.
#
# Available parameters:
# - $TestSetup: Object containing test setup parameters
# - $TestType: String indicating the type of test being run (e.g., "crash-capture", "message-capture")
# - $SentryEvent: The Sentry event object retrieved from the REST API containing error/message details
# - $RunResult: Object containing the results of running the test application, including Output and ExitCode

$CommonTestCases = @(
@{ Name = "Outputs event ID"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$eventId = Get-EventIds -appOutput $RunResult.Output -expectedCount 1
$eventId | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Captures event in sentry.io"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Has title"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.title | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Has correct release version"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.release.version | Should -Be "sentry-unity-test@1.0.0"
}
}
@{ Name = "Has correct dist attribute"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.dist | Should -Be "test-dist"
}
}
@{ Name = "Has tags"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.tags | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Has correct integration test tags"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
($SentryEvent.tags | Where-Object { $_.key -eq "test.suite" }).value | Should -Be "integration"
($SentryEvent.tags | Where-Object { $_.key -eq "test.type" }).value | Should -Be $TestType
}
}
@{ Name = "Has correct environment tag"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
($SentryEvent.tags | Where-Object { $_.key -eq "environment" }).value | Should -Be "integration-test"
}
}
@{ Name = "Contains user information"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)

if ($TestType -eq "crash-capture") {
# User context may not survive native crashes on all platforms
return
}

$SentryEvent.user | Should -Not -BeNullOrEmpty
$SentryEvent.user.username | Should -Be "TestUser"
$SentryEvent.user.email | Should -Be "user-mail@test.abc"
$SentryEvent.user.id | Should -Be "12345"
}
}
@{ Name = "Contains breadcrumbs"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)

if ($TestType -eq "crash-capture") {
# Breadcrumbs may not survive native crashes
return
}

$SentryEvent.breadcrumbs | Should -Not -BeNullOrEmpty
$SentryEvent.breadcrumbs.values | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains expected breadcrumbs"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)

if ($TestType -eq "crash-capture") {
return
}

$SentryEvent.breadcrumbs.values | Should -Not -BeNullOrEmpty
$SentryEvent.breadcrumbs.values | Where-Object { $_.message -eq "Integration test started" } | Should -Not -BeNullOrEmpty
$SentryEvent.breadcrumbs.values | Where-Object { $_.message -eq "Context configuration finished" } | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains SDK information"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.sdk | Should -Not -BeNullOrEmpty
$SentryEvent.sdk.name | Should -Not -BeNullOrEmpty
$SentryEvent.sdk.version | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains app context"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)

if ($TestType -eq "crash-capture") {
# App context may not be available for native crashes
return
}

$SentryEvent.contexts.app | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains device context"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.contexts.device | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains OS context"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)
$SentryEvent.contexts.os | Should -Not -BeNullOrEmpty
$SentryEvent.contexts.os.name | Should -Not -BeNullOrEmpty
}
}
@{ Name = "Contains Unity context"; TestBlock = {
param($TestSetup, $TestType, $SentryEvent, $RunResult)

if ($TestType -eq "crash-capture") {
# Unity context may not be synchronized to NDK for native crashes
return
}

$SentryEvent.contexts.unity | Should -Not -BeNullOrEmpty
}
}
)
Loading
Loading