Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b9cb337
feat: update Kover plugin to 0.9.1 and normalize paths in coverage re…
grablack Jul 28, 2025
963487a
Merge branch 'develop' into chore/fix-coverage-report
grablack Oct 20, 2025
a09a0a5
feat: add manifest merger test module and CI integration
grablack Oct 20, 2025
fdd0ffb
fix: downgrade Kover plugin to 0.7.6 and adjust configuration for com…
grablack Oct 20, 2025
bccfb9a
test: enhance Logo and PayPal composable tests with various scenarios
grablack Oct 20, 2025
1b1393f
test: enhance PayPal composable tests with additional configurations …
grablack Oct 20, 2025
dcb7f56
test: update PayPalComposableModalTest with additional assertions and…
grablack Oct 20, 2025
4b7186b
Merge branch 'develop' into chore/fix-coverage-report
grablack Oct 22, 2025
994f868
chore: re-enable Kover plugin and update configuration for coverage r…
grablack Oct 22, 2025
7909f12
test: add unit tests for Channel, ProductGroup, PayPalMessageConfig, …
grablack Oct 22, 2025
a2d7f92
ci: enhance coverage report validation and path normalization in GitH…
grablack Oct 23, 2025
7097331
chore(ci): retrigger code coverage report
grablack Oct 27, 2025
8bfc539
ci: improve coverage report logging and clarify gradle task
grablack Oct 27, 2025
f8b9b6e
rerun code coverage
grablack Oct 27, 2025
18e130c
feat: add isolated test task for memory-intensive tests and enhance c…
grablack Oct 27, 2025
374f3c5
chore: update Kover plugin configuration in build.gradle files
grablack Oct 28, 2025
1db638c
fix: exclude demo module from Kover coverage reports
grablack Oct 28, 2025
6616383
fix: remove invalid excludeProjects property from Kover config
grablack Oct 28, 2025
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
86 changes: 84 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,33 @@ jobs:
cache: gradle

- name: Run Unit Tests Coverage
run: ./gradlew koverXmlReportDebug
run: ./gradlew :library:koverXmlReportDebug -Dkover.path.normalization=relative

- name: Check if coverage report was generated
run: |
echo "Checking for Kover report files..."
find library/build -name "*.xml" -path "*/kover/*" -ls || echo "No Kover XML files found"
ls -la library/build/reports/kover/ || echo "Kover reports directory does not exist"

- name: Normalize paths in coverage report
run: |
# Check if the report file exists
if [ ! -f "library/build/reports/kover/reportDebug.xml" ]; then
echo "ERROR: Coverage report not found at library/build/reports/kover/reportDebug.xml"
exit 1
fi

# Create a backup of the original report
cp library/build/reports/kover/reportDebug.xml library/build/reports/kover/reportDebug.xml.bak

# Replace absolute paths with relative ones for GitHub Actions runners
# GitHub Actions uses /home/runner/work/paypal-messages-android/paypal-messages-android/
sed -i 's|/home/runner/work/paypal-messages-android/paypal-messages-android/|./|g' library/build/reports/kover/reportDebug.xml

# Also handle any other absolute paths that might appear
sed -i 's|${{ github.workspace }}/|./|g' library/build/reports/kover/reportDebug.xml

echo "Path normalization completed successfully"

- name: Show Coverage Report XML
run: cat library/build/reports/kover/reportDebug.xml
Expand All @@ -60,7 +86,7 @@ jobs:
with:
path: ${{ github.workspace }}/library/build/reports/kover/reportDebug.xml
title: Code Coverage
update-comment: true
update-comment: false
min-coverage-overall: 85
min-coverage-changed-files: 85
coverage-counter-type: LINE
Expand Down Expand Up @@ -226,6 +252,62 @@ jobs:
./gradlew demo:compileDebugKotlin
echo "✅ Reflection test code compiles successfully"

test_manifest_merger:
name: Manifest Merger Conflict Test
runs-on: ubuntu-latest
permissions:
contents: read

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

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Build Test Module with Manifest Merger
run: |
echo "🔍 Testing manifest merger with usesCleartextTraffic conflict..."

# Build the test module that declares its own usesCleartextTraffic
# This will fail if the library's manifest causes a merger conflict
./gradlew :manifest-merger-test:assembleDebug

if [ $? -eq 0 ]; then
echo "✅ Manifest merger succeeded - no conflict detected!"
else
echo "❌ ERROR: Manifest merger failed - library causes usesCleartextTraffic conflict!"
exit 1
fi

- name: Verify Merged Manifest
run: |
echo "🔍 Verifying merged manifest content..."

# Check that the merged manifest exists
MERGED_MANIFEST="manifest-merger-test/build/intermediates/merged_manifests/debug/AndroidManifest.xml"

if [ ! -f "$MERGED_MANIFEST" ]; then
echo "❌ ERROR: Merged manifest not found at $MERGED_MANIFEST"
exit 1
fi

echo "📄 Merged manifest content:"
cat "$MERGED_MANIFEST"

# Verify that usesCleartextTraffic is present in merged manifest
if grep -q "usesCleartextTraffic" "$MERGED_MANIFEST"; then
echo "✅ usesCleartextTraffic attribute found in merged manifest"
else
echo "❌ WARNING: usesCleartextTraffic attribute not found in merged manifest"
fi

echo "🎉 Manifest merger test completed successfully!"

test_publishing_tasks:
name: Publishing Tasks Verification
runs-on: ubuntu-latest
Expand Down
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ plugins {
id 'signing'
id 'maven-publish'
id 'io.codearte.nexus-staging' version '0.30.0'
id 'org.jetbrains.kotlinx.kover' version '0.7.6' apply false
}

tasks.register('ktLint', LintTask) {
Expand Down Expand Up @@ -284,6 +285,15 @@ tasks.register('checkCentralPortalDeployment') {

subprojects {
group = "com.paypal.messages"

// Disable Kover for demo module
if (project.name == 'demo') {
pluginManager.withPlugin('org.jetbrains.kotlinx.kover') {
kover {
isDisabled = true
}
}
}
}

// Configure Nexus Staging to close and release automatically (OSSRH s01)
Expand Down
119 changes: 82 additions & 37 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'kotlin-android'
id 'org.jetbrains.kotlin.android'
id 'de.mannodermaus.android-junit5' version "1.9.3.0"
id 'org.jetbrains.kotlinx.kover' version '0.7.6'
id 'org.jetbrains.kotlinx.kover'
}

group = "com.paypal.messages"
Expand Down Expand Up @@ -122,6 +122,12 @@ tasks.withType(Test).configureEach {
// Example filter: excludeTestsMatching "com.paypal.messages.PayPalModalActivityTest"
}

// Configure all Kover tasks to use relative paths
// Note: Task type configuration disabled for Kover 0.7.6 compatibility
// tasks.withType(org.jetbrains.kotlinx.kover.gradle.plugin.tasks.KoverXmlReportTask).configureEach {
// systemProperty 'kover.path.normalization', 'relative'
// }

// Optimized approach for handling problematic tests
android {
testOptions {
Expand Down Expand Up @@ -179,45 +185,84 @@ tasks.register('testMemoryIntensiveClasses') {
description = "Runs memory-intensive tests in isolated JVM processes"
}

koverReport {
androidReports('debug') {
filters {
excludes {
annotatedBy(
'*KoverExcludeGenerated'
)
classes(
// AnalyticsLogger,
'com.paypal.messages.analytics.AnalyticsLogger*',
// config
'com.paypal.messages.config.message.PayPalMessageEventsCallbacks\$*',
'com.paypal.messages.config.message.PayPalMessageViewStateCallbacks\$*',
'com.paypal.messages.config.modal.ModalEvents\$*',
// extensions,
'com.paypal.messages.extensions.Int*',
// io
'com.paypal.messages.io.Api',
'com.paypal.messages.io.Api\$*',
'com.paypal.messages.io.LocalStorage*',
'com.paypal.messages.io.OnActionCompleted',
// utils
'com.paypal.messages.utils.LogCat*',
// UI Stuff
'*Fragment',
'*Fragment\$*',
'*Activity',
'*Activity\$*',
'com.paypal.messages.PayPalMessageView*',
'com.paypal.messages.RoundedWebView',
'com.paypal.messages.RoundedWebView\$*',
'*.databinding.*',
'*.BuildConfig'
)
}
// Note: The koverXmlReportDebug task is now provided by the Kover plugin
// If you encounter SSL/dependency issues locally, you can temporarily disable Kover by:
// 1. Commenting out the Kover plugin line above
// 2. Setting SKIP_KOVER=true environment variable

// Add a task to test the coverage report paths
tasks.register('testKoverPaths') {
dependsOn 'koverXmlReportDebug'

doLast {
println "\n\n===== Testing Kover paths in coverage report =====\n"

def reportFile = file("${buildDir}/reports/kover/reportDebug.xml")
if (!reportFile.exists()) {
throw new GradleException("Coverage report file not found at: ${reportFile.absolutePath}")
}

println "Checking coverage report for absolute paths..."

def reportContent = reportFile.text
def absolutePathPattern = "/Users/"
def hasAbsolutePaths = reportContent.contains(absolutePathPattern)

if (hasAbsolutePaths) {
println "WARNING: Found absolute paths in the coverage report!"
println "Creating normalized version..."

// Create a backup of the original report
def backupFile = file("${buildDir}/reports/kover/reportDebug.xml.bak")
backupFile.text = reportContent

// Replace absolute paths with relative ones
def normalizedContent = reportContent.replaceAll("/Users/[^/]*/Code/paypal-messages-android/", "./")
reportFile.text = normalizedContent

println "Normalized coverage report saved to: ${reportFile.absolutePath}"
} else {
println "SUCCESS: No absolute paths found in the coverage report."
}
}
description = "Tests and fixes paths in Kover coverage reports"
}

kover {
filters {
classes {
excludes += [
// AnalyticsLogger,
'com.paypal.messages.analytics.AnalyticsLogger*',
// config
'com.paypal.messages.config.message.PayPalMessageEventsCallbacks\$*',
'com.paypal.messages.config.message.PayPalMessageViewStateCallbacks\$*',
'com.paypal.messages.config.modal.ModalEvents\$*',
// extensions,
'com.paypal.messages.extensions.Int*',
// io
'com.paypal.messages.io.Api',
'com.paypal.messages.io.Api\$*',
'com.paypal.messages.io.LocalStorage*',
'com.paypal.messages.io.OnActionCompleted',
// utils
'com.paypal.messages.utils.LogCat*',
// UI Stuff
'*Fragment',
'*Fragment\$*',
'*Activity',
'*Activity\$*',
'com.paypal.messages.PayPalMessageView*',
'com.paypal.messages.RoundedWebView',
'com.paypal.messages.RoundedWebView\$*',
'*.databinding.*',
'*.BuildConfig'
]
}
}
}


dependencies {
implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
Expand Down Expand Up @@ -277,7 +322,7 @@ project.ext.version = modules.sdkVersionName
project.ext.pom_name = "PayPal Messages"
project.ext.pom_desc = "The PayPal Android SDK Messages Module: Promote offers to your customers such as Pay Later and PayPal Credit."

// Optionally disable Kover locally to avoid agent download issues
// Optionally disable Kover tasks locally to avoid agent download issues
if (System.getenv('SKIP_KOVER') == 'true' || project.hasProperty('skipKover')) {
tasks.matching { it.name.toLowerCase().startsWith('kover') }.configureEach { enabled = false }
}
Expand Down
Loading