Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c4ed2fc
Exclude SentryOptions from obfuscation
markushi May 4, 2023
b52343e
Update Changelog
markushi May 4, 2023
762b5ae
Run agp test matrix against UI test app
romtsn May 8, 2023
f2a8d85
Revert dependencies
romtsn May 8, 2023
c28a4d8
Change concurrency
romtsn May 8, 2023
a104138
Change concurrency
romtsn May 8, 2023
b2e4809
Use keeper
romtsn May 9, 2023
c68e9e9
Revert keep rule for ndk
romtsn May 9, 2023
70a7bae
Switch to android-core artifact
romtsn May 9, 2023
db169f5
Adjust proguard rules for AGP 8.0
romtsn May 9, 2023
c4b49d1
Specify testProguardFiles
romtsn May 10, 2023
7911bdc
Remove some dependencies
romtsn May 10, 2023
efa961f
Add more proguard rules and make agp matrix a job
romtsn May 10, 2023
c555b1d
Add more rules
romtsn May 10, 2023
fed7035
Replace non-existing devices on SauceLabs
romtsn May 10, 2023
6b24c32
Use keeper instead of dontshrink, add NDK matrix
romtsn May 10, 2023
53499df
Merge branch 'main' into fix/r8_full_mode_nosuchelement
romtsn May 10, 2023
40d46ea
Specify testBuildType for assembleRelease
romtsn May 11, 2023
45f1258
Reorder tasks
romtsn May 11, 2023
c2404f8
Revert dontshrink & remove keeper
romtsn May 11, 2023
8444408
Revert makefile
romtsn May 11, 2023
bbbae9e
tweaks
romtsn May 11, 2023
80f8beb
Change concurrency
romtsn May 11, 2023
c0875f0
Ignore flaky test and run AGP matrix on emulators
romtsn May 15, 2023
642fdf2
Merge branch 'main' into fix/r8_full_mode_nosuchelement
romtsn May 15, 2023
09f9a1a
Adapt emulator config
romtsn May 15, 2023
e81f931
Run agp test matrix for release
romtsn May 15, 2023
e58e10b
Format code
getsentry-bot May 15, 2023
5113cc6
Changelog
romtsn May 15, 2023
7e8e5f5
Merge branch 'main' into fix/r8_full_mode_nosuchelement
romtsn May 15, 2023
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
39 changes: 30 additions & 9 deletions .github/workflows/agp-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: AGP Matrix Sample Release
name: AGP Matrix Compatibility

on:
push:
Expand All @@ -16,29 +16,50 @@ jobs:
with:
access_token: ${{ github.token }}

agp-matrix-sample-release:
runs-on: ubuntu-latest
agp-matrix-compatibility:
timeout-minutes: 25
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
agp: ['8.0.0-rc01','8.1.0-alpha11']
agp: [ '8.0.0','8.1.0-alpha11' ]
ndk: [ true, false ]

name: AGP Matrix Sample Release - AGP ${{ matrix.agp }}
name: AGP Matrix Release - AGP ${{ matrix.agp }} - NDK ${{ matrix.ndk }}
env:
VERSION_AGP: ${{ matrix.agp }}
APPLY_NDK: ${{ matrix.ndk }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # pin@v2

- name: Setup Java Version
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Build the Release variant
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # pin@v2
# Clean, build and release a test apk
- name: Make assembleUiTests
run: make assembleUiTests

# We stop gradle at the end to make sure the cache folders
# don't contain any lock files and are free to be cached.
- name: Make stop
run: make stop

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # pin@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
arguments: sentry-android-integration-tests:sentry-test-agp:assembleRelease
api-level: 30
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
disable-spellchecker: true
target: 'aosp_atd'
channel: canary # Necessary for ATDs
script: ./gradlew sentry-android-integration-tests:sentry-uitest-android:connectedReleaseAndroidTest -DtestBuildType=release --daemon
11 changes: 10 additions & 1 deletion .github/workflows/integration-tests-ui.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Integration Tests - Ui tests'
name: 'Integration Tests'
on:
push:
branches:
Expand All @@ -7,6 +7,14 @@ on:
pull_request:

jobs:
cancel-previous-workflow:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # pin@0.11.0
with:
access_token: ${{ github.token }}

test:
name: Ui tests
runs-on: ubuntu-latest
Expand Down Expand Up @@ -43,3 +51,4 @@ jobs:
sauce-access-key: ${{ secrets.SAUCE_ACCESS_KEY }}
config-file: .sauce/sentry-uitest-android-ui.yml
if: env.SAUCE_USERNAME != null

2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
- Android Profiler on calling thread ([#2691](https://github.com/getsentry/sentry-java/pull/2691))
- Use `configureScope` instead of `withScope` in `Hub.close()`. This ensures that the main scope releases the in-memory data when closing a hub instance. ([#2688](https://github.com/getsentry/sentry-java/pull/2688))
- Remove null keys/values before creating concurrent hashmap in order to avoid NPE ([#2708](https://github.com/getsentry/sentry-java/pull/2708))
- Exclude SentryOptions from R8/ProGuard obfuscation ([#2699](https://github.com/getsentry/sentry-java/pull/2699))
- This fixes AGP 8.+ incompatibility, where full R8 mode is enforced

### Dependencies

Expand Down
4 changes: 4 additions & 0 deletions sentry-android-core/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@
# Keep Classnames for integrations
-keepnames class * implements io.sentry.IntegrationName

# Keep any custom option classes like SentryAndroidOptions, as they're loaded via reflection
# Also keep method names, as they're e.g. used by native via JNI calls
-keep class * extends io.sentry.SentryOptions { *; }

##---------------End: proguard configuration for android-core ----------
2 changes: 1 addition & 1 deletion sentry-android-integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* [App metrics test specification (yaml)](./metrics-test.yml)
* [Espresso-based benchmarks](./sentry-uitest-android-benchmark) - run within SauceLabs (see /.sauce/*.yml)
* [Espresso-based UI tests](./sentry-uitest-android) - run within SauceLabs (see /.sauce/*.yml)
* [Sample app for testing against AGP compatibility matrix](./sentry-test-agp)
* Also used for compatibility test matrix against new AGP versions

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ android {
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.getByName("debug") // to be able to run release mode
testProguardFiles("proguard-rules.pro")
}
}

Expand All @@ -87,11 +88,17 @@ android {
}
}

val applyNdk = System.getenv("APPLY_NDK")?.toBoolean() ?: false

dependencies {

implementation(kotlin(Config.kotlinStdLib, org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION))

implementation(projects.sentryAndroid)
if (applyNdk) {
implementation(projects.sentryAndroid)
} else {
implementation(projects.sentryAndroidCore)
}
implementation(projects.sentryCompose)
implementation(Config.Libs.appCompat)
implementation(Config.Libs.androidxCore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,23 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile

#Shrinking removes annotations and "unused classes" from test apk, so we don't shrink
-dontshrink

-dontwarn com.google.errorprone.**
-dontwarn com.sun.jna.**
-dontwarn edu.umd.cs.findbugs.**
-dontwarn java.lang.instrument.**
-dontwarn java.lang.management.**
-dontwarn okhttp3.Handshake$Companion
-dontwarn okhttp3.Headers$Companion
-dontwarn okhttp3.HttpUrl$Companion
-dontwarn okhttp3.Protocol$Companion
-dontwarn okhttp3.internal.**
-dontwarn okio.ByteString$Companion
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
-dontwarn org.opentest4j.AssertionFailedError
-dontwarn org.mockito.internal.**
-dontwarn org.jetbrains.annotations.**

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import io.sentry.Sentry
import io.sentry.android.core.SentryAndroid
import io.sentry.android.core.SentryAndroidOptions
import io.sentry.uitest.android.mockservers.MockRelay
import java.io.FileInputStream
import java.util.concurrent.TimeUnit
import kotlin.test.AfterTest
import kotlin.test.BeforeTest
Expand Down Expand Up @@ -39,6 +40,17 @@ abstract class BaseUiTest {
/** Mock relay server that receives all envelopes sent during the test. */
protected val relay = MockRelay(false, relayIdlingResource)

private fun disableDontKeepActivities() {
val automation = InstrumentationRegistry.getInstrumentation().uiAutomation
val pfd = automation.executeShellCommand("settings put global always_finish_activities 0")
try {
FileInputStream(pfd.fileDescriptor).readBytes()
} catch (e: Throwable) {
// ignored
}
pfd.close()
}

@BeforeTest
fun baseSetUp() {
runner = InstrumentationRegistry.getInstrumentation() as AndroidJUnitRunner
Expand All @@ -47,6 +59,7 @@ abstract class BaseUiTest {
context.cacheDir.deleteRecursively()
relay.start()
mockDsn = relay.createMockDsn()
disableDontKeepActivities()
}

@AfterTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import io.sentry.protocol.SentryTransaction
import org.junit.runner.RunWith
import java.io.File
import java.util.concurrent.TimeUnit
import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
Expand All @@ -43,6 +44,7 @@ class EnvelopeTests : BaseUiTest() {
}
}

@Ignore("Something is wrong with measurements assertions, flaking almost every time")
@Test
fun checkEnvelopeProfiledTransaction() {
initSentry(true) { options: SentryAndroidOptions ->
Expand Down
4 changes: 2 additions & 2 deletions sentry-android-ndk/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# The Android SDK checks at runtime if this class is available via Class.forName
-keep class io.sentry.android.ndk.SentryNdk { *; }
# The JNI layer uses this classes through reflection
-keep class io.sentry.android.core.SentryAndroidOptions { *; }

# The JNI layer uses this class through reflection
-keep class io.sentry.protocol.DebugImage { *; }

# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
Expand Down
3 changes: 1 addition & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ include(
"sentry-android-integration-tests:sentry-uitest-android-benchmark",
"sentry-android-integration-tests:sentry-uitest-android",
"sentry-android-integration-tests:test-app-plain",
"sentry-android-integration-tests:test-app-sentry",
"sentry-android-integration-tests:sentry-test-agp"
"sentry-android-integration-tests:test-app-sentry"
)

gradle.beforeProject {
Expand Down