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
25 changes: 25 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@ jobs:
- name: spotless
run: ./gradlew spotlessCheck

test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3.1.0
- name: Set up JDK
uses: actions/setup-java@v3.5.1
with:
distribution: zulu
java-version: 17
- uses: gradle/gradle-build-action@v2.7.1
- name: Make Gradle executable
run: chmod +x ./gradlew
- name: Run unit tests
run: ./gradlew testDebugUnitTest --stacktrace
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: |
**/build/reports/tests/
**/build/test-results/

build:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions baselineprofile/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {

android {
namespace = "com.revenuecat.articles.paywall.baselineprofile"
compileSdk = 35
compileSdk = 36

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand All @@ -35,7 +35,7 @@ android {

defaultConfig {
minSdk = 28
targetSdk = 35
targetSdk = 36
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
commonExtension.apply {
compileSdk = 35
compileSdk = 36

defaultConfig {
minSdk = 21
minSdk = 24
}

compileOptions {
Expand Down
56 changes: 56 additions & 0 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,73 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.Properties

plugins {
id("revenuecat.android.library")
id("revenuecat.android.hilt")
id("revenuecat.spotless")
}

// Load local.properties
val localProperties = Properties().apply {
val localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { load(it) }
}
}

android {
namespace = "com.revenuecat.articles.paywall.compose.core.data"

buildFeatures {
buildConfig = true
}

defaultConfig {
// Add RevenueCat Test Store API key to BuildConfig for unit tests
buildConfigField(
"String",
"REVENUECAT_TEST_API_KEY",
"\"${localProperties.getProperty("revenuecat.test.api.key", "")}\""
)

// Set configuration for androidTest
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

testOptions {
unitTests {
isIncludeAndroidResources = true
}
}

// Exclude hilt-navigation-compose from androidTest to avoid minSdk conflicts
configurations {
getByName("androidTestImplementation") {
exclude(group = "androidx.hilt", module = "hilt-navigation-compose")
}
}
}

dependencies {
api(projects.core.model)
api(projects.core.network)
implementation(libs.androidx.junit.ktx)

// Testing
testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.turbine)
testImplementation(libs.revenuecat) // Required for extension functions

// Android Instrumentation Testing (for Test Store integration tests)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.kotlinx.coroutines.test)
androidTestImplementation(libs.turbine)
androidTestImplementation(libs.revenuecat) // Required for RevenueCat SDK
}
27 changes: 27 additions & 0 deletions core/data/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2025 RevenueCat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<!-- Test Activity for RevenueCat Test Store purchase flow tests -->
<activity
android:name="com.revenuecat.articles.paywall.coredata.repository.TestPurchaseActivity"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
</application>

</manifest>
Loading
Loading