From 6989c6c3bd92db740a517418671e55d9b3824b64 Mon Sep 17 00:00:00 2001 From: Rd Date: Mon, 19 Aug 2024 00:57:58 +0530 Subject: [PATCH] Code Coverage Status Check on pb file presence, Lint fixes --- .github/workflows/coverage_report.yml | 2 +- .../coverage/reporter/CoverageReporter.kt | 17 ++++++++--------- .../coverage/reporter/CoverageReporterTest.kt | 5 ++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/coverage_report.yml b/.github/workflows/coverage_report.yml index d49430ff069..19593b184e6 100644 --- a/.github/workflows/coverage_report.yml +++ b/.github/workflows/coverage_report.yml @@ -145,7 +145,7 @@ jobs: needs: [ evaluate-code-coverage-reports, comment_coverage_report ] # The expression if: ${{ !cancelled() }} runs a job or step regardless of its success or failure while responding to cancellations, # serving as a cancellation-compliant alternative to if: ${{ always() }} in concurrent workflows. - if: ${{ needs.compute_changed_files.outputs.can_skip_files != 'true' && !cancelled()}} + if: ${{ needs.evaluate-code-coverage-reports.outputs.pb_file_empty != 'true' && !cancelled()}} runs-on: ubuntu-20.04 steps: - name: Check that coverage status is passed diff --git a/scripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt b/scripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt index c192a9d110d..31763392945 100644 --- a/scripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt +++ b/scripts/src/java/org/oppia/android/scripts/coverage/reporter/CoverageReporter.kt @@ -496,15 +496,6 @@ class CoverageReporter( } } - val skipCoverageReportText = buildString { - append("## Coverage Report\n") - append("### Results\n") - append("Coverage Analysis: **SKIP** :next_track_button:\n\n") - append("_This PR did not introduce any changes to Kotlin source or test files._\n\n") - append("#\n") - append("> To learn more, visit the [Oppia Android Code Coverage](https://github.com/oppia/oppia-android/wiki/Oppia-Android-Code-Coverage) wiki page") - } - val wikiPageLinkNote = buildString { val wikiPageReferenceNote = ">To learn more, visit the [Oppia Android Code Coverage]" + "(https://github.com/oppia/oppia-android/wiki/Oppia-Android-Code-Coverage) wiki page" @@ -514,6 +505,14 @@ class CoverageReporter( append(wikiPageReferenceNote) } + val skipCoverageReportText = buildString { + append("## Coverage Report\n") + append("### Results\n") + append("Coverage Analysis: **SKIP** :next_track_button:\n\n") + append("_This PR did not introduce any changes to Kotlin source or test files._") + append(wikiPageLinkNote) + } + val finalReportText = coverageReportContainer.coverageReportList.takeIf { it.isNotEmpty() } ?.let { "## Coverage Report\n\n" + diff --git a/scripts/src/javatests/org/oppia/android/scripts/coverage/reporter/CoverageReporterTest.kt b/scripts/src/javatests/org/oppia/android/scripts/coverage/reporter/CoverageReporterTest.kt index 2014f5f32a3..b0af56a1115 100644 --- a/scripts/src/javatests/org/oppia/android/scripts/coverage/reporter/CoverageReporterTest.kt +++ b/scripts/src/javatests/org/oppia/android/scripts/coverage/reporter/CoverageReporterTest.kt @@ -1023,9 +1023,8 @@ class CoverageReporterTest { append("## Coverage Report\n") append("### Results\n") append("Coverage Analysis: **SKIP** :next_track_button:\n\n") - append("_This PR did not introduce any changes to Kotlin source or test files._\n\n") - append("#\n") - append("> To learn more, visit the [Oppia Android Code Coverage](https://github.com/oppia/oppia-android/wiki/Oppia-Android-Code-Coverage) wiki page") + append("_This PR did not introduce any changes to Kotlin source or test files._") + append(oppiaCoverageWikiPageLinkNote) } assertThat(readFinalMdReport()).isEqualTo(expectedMarkdown)