Skip to content
Merged
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
21 changes: 10 additions & 11 deletions .github/actions/generate-coverage/scripts/run_rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from coverage_parsers import get_line_coverage_percent_from_lcov
from plumbum.cmd import cargo
from plumbum.commands.processes import ProcessExecutionError

from shared_utils import read_previous_coverage

try: # runtime import for graceful fallback
Expand Down Expand Up @@ -127,16 +126,6 @@ def _run_cargo(args: list[str]) -> str:
else:
typer.echo(line, err=True, nl=False)

def read_previous(baseline: Path | None) -> str | None:
"""Return the previously stored coverage percentage if available."""
if baseline and baseline.is_file():
try:
return f"{float(baseline.read_text().strip()):.2f}"
except ValueError:
return None
return None


retcode = proc.wait()
if retcode != 0:
typer.echo(
Expand All @@ -147,6 +136,16 @@ def read_previous(baseline: Path | None) -> str | None:
return "\n".join(stdout_lines)


def read_previous(baseline: Path | None) -> str | None:
"""Return the previously stored coverage percentage if available."""
if baseline and baseline.is_file():
try:
return f"{float(baseline.read_text().strip()):.2f}"
except ValueError:
return None
return None


def _merge_lcov(base: Path, extra: Path) -> None:
"""Merge two lcov files ensuring they end with ``end_of_record``."""
try:
Expand Down