-
-
Notifications
You must be signed in to change notification settings - Fork 58
chore: Utilize app-runner for Android #2548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
65bfb99
d90e410
323d187
5b30b7d
20554a9
b899cc5
7c93e12
3dceec0
e999f6e
b6fc8a2
f39fb13
3902b68
0638d92
f05f223
160f355
f5e1c10
10ba69c
c2e1256
a0318cf
aa815ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
|
@@ -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: | ||
|
|
@@ -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 }} | ||
|
|
@@ -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' | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pester
|
||
|
|
||
| - 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 | ||
| 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 | ||
| } | ||
| } | ||
| ) |


Uh oh!
There was an error while loading. Please reload this page.