Skip to content

Commit a2d3262

Browse files
Enable Spotless verification for Android Port and add PR comments
- Added `spotless-maven-plugin` to `maven/android/pom.xml` configured for `Ports/Android/src`. - Updated `scripts/build-android-port.sh` to run `spotless:check` using JDK 17. - Updated `.github/workflows/scripts-android.yml` to generate and publish quality reports (including coverage) as a PR comment. - Updated `.github/scripts/generate-quality-report.py` to support suppressing missing reports to avoid noise in the Android comment.
1 parent 7370b61 commit a2d3262

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.github/scripts/generate-quality-report.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ def format_spotbugs(
514514
details = error.split("\n", 1)[0]
515515
return [f"- ⚠️ SpotBugs: report could not be parsed ({details})."]
516516
if not generated:
517+
if os.environ.get("QUALITY_REPORT_SUPPRESS_MISSING") == "1":
518+
return []
517519
return [
518520
"- ✅ SpotBugs: no findings (report was not generated by the build).",
519521
]
@@ -543,6 +545,8 @@ def format_pmd(
543545
blob_base: Optional[str],
544546
) -> List[str]:
545547
if not data:
548+
if os.environ.get("QUALITY_REPORT_SUPPRESS_MISSING") == "1":
549+
return []
546550
return ["- ⚠️ PMD report not generated."]
547551
total = sum(data.totals.values())
548552
status = "✅" if total == 0 else "❌"
@@ -568,6 +572,8 @@ def format_checkstyle(
568572
blob_base: Optional[str],
569573
) -> List[str]:
570574
if not data:
575+
if os.environ.get("QUALITY_REPORT_SUPPRESS_MISSING") == "1":
576+
return []
571577
return ["- ⚠️ Checkstyle report not generated."]
572578
total = sum(data.totals.values())
573579
status = "✅" if total == 0 else "❌"

.github/workflows/scripts-android.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ jobs:
162162
if-no-files-found: warn
163163
retention-days: 14
164164
compression-level: 6
165+
- name: Prepare coverage for quality report
166+
if: ${{ always() && matrix.id == 'default' }}
167+
run: |
168+
mkdir -p artifacts/android-coverage-report/site/jacoco
169+
if [ -f artifacts/android-coverage-report/jacocoAndroidReport.xml ]; then
170+
cp artifacts/android-coverage-report/jacocoAndroidReport.xml artifacts/android-coverage-report/site/jacoco/jacoco.xml
171+
else
172+
echo "No coverage XML found at expected path."
173+
fi
165174
- name: Generate quality report summary
166175
if: ${{ always() && matrix.id == 'default' }}
167176
env:
@@ -171,6 +180,7 @@ jobs:
171180
QUALITY_REPORT_REF: ${{ github.event.pull_request.head.sha || github.sha }}
172181
JACOCO_REPORT_URL: ${{ steps.upload-quality-artifacts.outputs.artifact-url }}
173182
QUALITY_REPORT_TITLE: "✅ Android Quality Report"
183+
QUALITY_REPORT_SUPPRESS_MISSING: "1"
174184
run: python3 .github/scripts/generate-quality-report.py
175185
- name: Publish quality report comment
176186
if: ${{ github.event_name == 'pull_request' && matrix.id == 'default' }}

0 commit comments

Comments
 (0)