Loading .gitlab-ci.yml +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ test: when: always script: - ./gradlew test jacocoDebugReport -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" - python3 scripts/print_instruction_coverage.py app/build/reports/jacoco/jacocoDebugReport/jacocoDebugReport.xml coverage: '/INSTRUCTION_COVERAGE\\s+([0-9]{1,3}\\.?[0-9]*)%/' artifacts: when: always paths: Loading scripts/print_instruction_coverage.py 0 → 100644 +19 −0 Original line number Diff line number Diff line import sys import xml.etree.ElementTree as ET def main() -> None: report_path = sys.argv[1] if len(sys.argv) > 1 else "app/build/reports/jacoco/jacocoDebugReport/jacocoDebugReport.xml" xml_root = ET.parse(report_path).getroot() instruction_counter = next( counter for counter in xml_root.findall("counter") if counter.attrib["type"] == "INSTRUCTION" ) missed_count = int(instruction_counter.attrib["missed"]) covered_count = int(instruction_counter.attrib["covered"]) total_instructions = covered_count + missed_count coverage_pct = covered_count / total_instructions * 100 if total_instructions else 0 print(f"INSTRUCTION_COVERAGE {coverage_pct:.2f}%") if __name__ == "__main__": main() Loading
.gitlab-ci.yml +2 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ test: when: always script: - ./gradlew test jacocoDebugReport -PtestAccountName="$testAccountName" -PtestAccountPwd="$testAccountPwd" -PtestServerUrl="$testServerUrl" - python3 scripts/print_instruction_coverage.py app/build/reports/jacoco/jacocoDebugReport/jacocoDebugReport.xml coverage: '/INSTRUCTION_COVERAGE\\s+([0-9]{1,3}\\.?[0-9]*)%/' artifacts: when: always paths: Loading
scripts/print_instruction_coverage.py 0 → 100644 +19 −0 Original line number Diff line number Diff line import sys import xml.etree.ElementTree as ET def main() -> None: report_path = sys.argv[1] if len(sys.argv) > 1 else "app/build/reports/jacoco/jacocoDebugReport/jacocoDebugReport.xml" xml_root = ET.parse(report_path).getroot() instruction_counter = next( counter for counter in xml_root.findall("counter") if counter.attrib["type"] == "INSTRUCTION" ) missed_count = int(instruction_counter.attrib["missed"]) covered_count = int(instruction_counter.attrib["covered"]) total_instructions = covered_count + missed_count coverage_pct = covered_count / total_instructions * 100 if total_instructions else 0 print(f"INSTRUCTION_COVERAGE {coverage_pct:.2f}%") if __name__ == "__main__": main()