From f04924ded54a1da6691f1ebf3ca0c08828d35cd2 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Sat, 21 Mar 2026 11:54:17 -0500 Subject: [PATCH] chore: Enhance CI coverage reporting and add main branch workflow (#4873) --- .github/workflows/main-check.yml | 24 +++++++ .github/workflows/reusable-check.yml | 2 +- codecov.yml | 70 ++++++++++++++++++- desktop/build.gradle.kts | 1 + .../testing-and-ci-playbook.md | 2 +- 5 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main-check.yml diff --git a/.github/workflows/main-check.yml b/.github/workflows/main-check.yml new file mode 100644 index 000000000..d32d2de37 --- /dev/null +++ b/.github/workflows/main-check.yml @@ -0,0 +1,24 @@ +name: Main CI (Verify & Build) + +on: + push: + branches: [ main ] + paths-ignore: + - '**/*.md' + - 'docs/**' + +concurrency: + group: main-${{ github.ref }} + cancel-in-progress: true + +jobs: + validate-and-build: + if: github.repository == 'meshtastic/Meshtastic-Android' + uses: ./.github/workflows/reusable-check.yml + with: + run_lint: true + run_unit_tests: true + run_instrumented_tests: true + api_levels: '[35]' # One API level is enough for post-merge sanity check + upload_artifacts: true + secrets: inherit diff --git a/.github/workflows/reusable-check.yml b/.github/workflows/reusable-check.yml index ccc7cff5e..3fa8dff85 100644 --- a/.github/workflows/reusable-check.yml +++ b/.github/workflows/reusable-check.yml @@ -89,7 +89,7 @@ jobs: - name: Shared Unit Tests & Coverage if: inputs.run_unit_tests == true - run: ./gradlew test koverXmlReport app:koverXmlReportFdroidDebug app:koverXmlReportGoogleDebug core:api:koverXmlReportDebug core:barcode:koverXmlReportFdroidDebug core:barcode:koverXmlReportGoogleDebug mesh_service_example:koverXmlReportDebug -Pci=true --continue --scan + run: ./gradlew test koverXmlReport app:koverXmlReportFdroidDebug app:koverXmlReportGoogleDebug core:api:koverXmlReportDebug core:barcode:koverXmlReportFdroidDebug core:barcode:koverXmlReportGoogleDebug mesh_service_example:koverXmlReportDebug desktop:koverXmlReport -Pci=true --continue --scan - name: KMP JVM Smoke Compile run: ./gradlew :core:proto:compileKotlinJvm :core:common:compileKotlinJvm :core:model:compileKotlinJvm :core:repository:compileKotlinJvm :core:di:compileKotlinJvm :core:navigation:compileKotlinJvm :core:resources:compileKotlinJvm :core:datastore:compileKotlinJvm :core:database:compileKotlinJvm :core:domain:compileKotlinJvm :core:prefs:compileKotlinJvm :core:network:compileKotlinJvm :core:data:compileKotlinJvm :core:ble:compileKotlinJvm :core:nfc:compileKotlinJvm :core:service:compileKotlinJvm :core:testing:compileKotlinJvm :core:ui:compileKotlinJvm :feature:intro:compileKotlinJvm :feature:messaging:compileKotlinJvm :feature:connections:compileKotlinJvm :feature:map:compileKotlinJvm :feature:node:compileKotlinJvm :feature:settings:compileKotlinJvm :feature:firmware:compileKotlinJvm -Pci=true --continue --scan diff --git a/codecov.yml b/codecov.yml index fa348a8f2..41210aaf6 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,71 @@ +# Codecov configuration for Meshtastic Android +# Ref: https://docs.codecov.com/docs/codecovyml-reference + +codecov: + branch: main + coverage: + precision: 2 + round: down + range: "70...100" status: - patch: off + project: + default: + target: auto # Coverage should not decrease from base branch + threshold: 1% # Allow 1% drop to reduce noise + patch: + default: + target: auto # New code should have coverage similar to project average + threshold: 1% + base: auto + +comment: + layout: "reach,diff,flags,files" + behavior: default + require_changes: false # Post a comment even if coverage doesn't change + +flags: + host-unit: + paths: + - . + carryforward: true + android-instrumented: + paths: + - . + carryforward: true + +component_management: + default_rules: + statuses: + - type: project + target: auto + threshold: 1% + individual_components: + - name: Core + paths: + - core/** + - name: Features + paths: + - feature/** + - name: App + paths: + - app/** + - name: Desktop + paths: + - desktop/** + - name: Example + paths: + - mesh_service_example/** + +ignore: + - "**/build/**" + - "**/*.pb.kt" # Generated Protobuf code + - "**/*.aidl" # AIDL interface files + - "**/aidl/**" # Generated AIDL code + - "core/resources/**" # Centralized resources + - "**/test/**" # Unit tests + - "**/androidTest/**" # Instrumented tests + - "**/*Test.kt" # Test files + - "**/*Mock.kt" # Fakes/Mocks + - "**/*Fake.kt" # Fakes + - "**/testing/**" # Shared test utilities diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 5615f8a77..668b1145b 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -28,6 +28,7 @@ plugins { alias(libs.plugins.meshtastic.detekt) alias(libs.plugins.meshtastic.spotless) alias(libs.plugins.meshtastic.koin) + id("meshtastic.kover") alias(libs.plugins.aboutlibraries) } diff --git a/docs/agent-playbooks/testing-and-ci-playbook.md b/docs/agent-playbooks/testing-and-ci-playbook.md index 3832720ab..6e227a736 100644 --- a/docs/agent-playbooks/testing-and-ci-playbook.md +++ b/docs/agent-playbooks/testing-and-ci-playbook.md @@ -56,7 +56,7 @@ Current reusable check workflow includes: - Android lint for all directly runnable Android modules: `app:lintFdroidDebug app:lintGoogleDebug core:barcode:lintFdroidDebug core:barcode:lintGoogleDebug core:api:lintDebug mesh_service_example:lintDebug` - Host tests plus coverage aggregation: - `test koverXmlReport app:koverXmlReportFdroidDebug app:koverXmlReportGoogleDebug core:api:koverXmlReportDebug core:barcode:koverXmlReportFdroidDebug core:barcode:koverXmlReportGoogleDebug mesh_service_example:koverXmlReportDebug` + `test koverXmlReport app:koverXmlReportFdroidDebug app:koverXmlReportGoogleDebug core:api:koverXmlReportDebug core:barcode:koverXmlReportFdroidDebug core:barcode:koverXmlReportGoogleDebug mesh_service_example:koverXmlReportDebug desktop:koverXmlReport` - JVM smoke compile for all KMP JVM targets (all compile-only modules remain explicit): `:core:proto:compileKotlinJvm :core:common:compileKotlinJvm :core:model:compileKotlinJvm :core:repository:compileKotlinJvm :core:di:compileKotlinJvm :core:navigation:compileKotlinJvm :core:resources:compileKotlinJvm :core:datastore:compileKotlinJvm :core:database:compileKotlinJvm :core:domain:compileKotlinJvm :core:prefs:compileKotlinJvm :core:network:compileKotlinJvm :core:data:compileKotlinJvm :core:ble:compileKotlinJvm :core:nfc:compileKotlinJvm :core:service:compileKotlinJvm :core:testing:compileKotlinJvm :core:ui:compileKotlinJvm :feature:intro:compileKotlinJvm :feature:messaging:compileKotlinJvm :feature:connections:compileKotlinJvm :feature:map:compileKotlinJvm :feature:node:compileKotlinJvm :feature:settings:compileKotlinJvm :feature:firmware:compileKotlinJvm` - Android build tasks: