Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,47 @@ jobs:

- name: Make stop
run: make stop

downgrade-compatibility:
name: Downgrade compatibility (${{ matrix.downgrade_version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
downgrade_version:
# Pin persisted-storage schema boundaries rather than the last N releases.
# 3.43.3 predates the replay minimum-duration buffer queue.
- 3.43.3
# 3.45.1 predates the persisted logs queue.
- 3.45.1
# 3.47.0 includes the logs queue but predates the current captureLog surface.
- 3.47.0

steps:
- name: Git checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: 'Set up Java 17'
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
java-version: '17'
distribution: 'temurin'

- name: Cache Gradle packages
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

- name: Test downgrade compatibility
env:
DOWNGRADE_VERSION: ${{ matrix.downgrade_version }}
run: make testDowngradeCompatibility

- name: Make stop
if: always()
run: make stop
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: clean compile stop checkFormat format api dryRelease release testReport test testJava generateLintBaseLine updateLocks
.PHONY: clean compile stop checkFormat format api dryRelease release testReport test testJava testDowngradeCompatibility generateLintBaseLine updateLocks

clean:
./gradlew clean
Expand Down Expand Up @@ -61,6 +61,9 @@ test:
testJava:
./gradlew :posthog:test

testDowngradeCompatibility:
DOWNGRADE_VERSION="$${DOWNGRADE_VERSION:-3.45.1}" ./scripts/test-downgrade-compatibility.sh

generateLintBaseLine:
rm -f posthog-android/lint-baseline.xml
./gradlew lintDebug -Dlint.baselines.continue=true
Expand Down
2 changes: 2 additions & 0 deletions scripts/downgrade-compatibility-smoke/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle/
build/
34 changes: 34 additions & 0 deletions scripts/downgrade-compatibility-smoke/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id 'com.android.library' version '8.9.1'
}

android {
namespace 'com.posthog.downgradecompatibility'
compileSdk 36

defaultConfig {
minSdk 23
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
all {
systemProperty 'posthog.smoke.mode', System.getProperty('posthog.smoke.mode', 'read')
systemProperty 'posthog.smoke.stateDir', System.getProperty('posthog.smoke.stateDir', '')
systemProperty 'posthog.smoke.apiKey', System.getProperty('posthog.smoke.apiKey', 'downgrade_compatibility_project')
}
}
}
}

dependencies {
String posthogVersion = providers.gradleProperty('posthogVersion').orElse('3.45.1').get()

testImplementation "com.posthog:posthog-android:${posthogVersion}"
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.14.1'
testImplementation 'com.google.code.gson:gson:2.10.1'
}
1 change: 1 addition & 0 deletions scripts/downgrade-compatibility-smoke/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.useAndroidX=true
33 changes: 33 additions & 0 deletions scripts/downgrade-compatibility-smoke/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}

rootProject.name = 'posthog-downgrade-compatibility-smoke'

String dependencyMode = settings.startParameter.projectProperties['posthogDependencyMode']
String dependencyPath = settings.startParameter.projectProperties['posthogDependencyPath']

if (dependencyMode == 'composite') {
if (dependencyPath == null || dependencyPath.trim().isEmpty()) {
throw new GradleException('posthogDependencyPath is required when posthogDependencyMode=composite')
}

includeBuild(dependencyPath) {
dependencySubstitution {
substitute(module('com.posthog:posthog')).using(project(':posthog'))
substitute(module('com.posthog:posthog-android')).using(project(':posthog-android'))
}
}
}
Loading
Loading