Skip to content
Open
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
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ jobs:
- name: Run Tests
run: yarn test

- name: Upload coverage reports
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/

- name: Assert that every file that should be public has been exported
run: ./scripts/assert_export.sh

Expand Down Expand Up @@ -99,9 +106,28 @@ jobs:
-scheme "sample" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,OS=latest,name=iPhone 16 Pro' \
-enableCodeCoverage YES \
-resultBundlePath TestResults.xcresult \
-only-testing:sampleTests \
test | bundle exec xcpretty && exit ${PIPESTATUS[0]}

- name: Install Slather
run: gem install slather

- name: Generate iOS HTML Report
working-directory: ./sample/ios
run: |
slather coverage --html --output-directory html-report --scheme sample --workspace sample.xcworkspace sample.xcodeproj

- name: Upload iOS coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: ios-coverage
path: |
sample/ios/TestResults.xcresult
sample/ios/html-report/

test-android:
needs: test-rn
runs-on: macOS-13
Expand Down Expand Up @@ -134,4 +160,11 @@ jobs:

- name: Run SDK Unit Tests
working-directory: ./sample/android
run: ./gradlew :react-native-usercentrics:test
run: ./gradlew :react-native-usercentrics:koverXmlReport :react-native-usercentrics:koverHtmlReport

- name: Upload Android coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: android-coverage
path: android/build/reports/kover/
Comment on lines +165 to +170
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL_BUG] The upload path for Android coverage is 'android/build/reports/kover/' which is likely incorrect given the workflow's working-directory is ./sample/android. The kover reports will usually be produced under sample/android//build/reports/kover or sample/android/build/reports/kover depending on module layout. Make the path explicit or use a glob to capture the generated report(s), e.g. path: 'sample/android//build/reports/kover/' or the exact module path 'sample/android/react-native-usercentrics/build/reports/kover/'. Otherwise the artifact will be empty and CI will appear to succeed but produce no coverage.

6 changes: 6 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ val isHermesEnabled = BooleanProperty("hermesEnabled")
plugins {
id("com.android.library")
id("kotlin-android")
id("org.jetbrains.kotlinx.kover") version "0.9.1"
}

if (isNewArchitectureEnabled) {
Expand All @@ -37,6 +38,11 @@ android {

}

buildTypes {
getByName("debug") {
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@
"jsx",
"json",
"node"
],
"collectCoverage": true,
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"!src/**/*.d.ts"
],
"coverageDirectory": "coverage",
"coverageReporters": [
"text",
"lcov"
]
},
"directories": {
Expand Down
Loading