41 lines
834 B
Python
41 lines
834 B
Python
from __future__ import annotations
|
|
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class BuildResult:
|
|
success: bool
|
|
artifact_path: str = ""
|
|
log: str = ""
|
|
|
|
|
|
@dataclass
|
|
class RunResult:
|
|
success: bool
|
|
records: list[dict] = field(default_factory=list)
|
|
log: str = ""
|
|
coverage_exec: str = ""
|
|
|
|
|
|
@dataclass
|
|
class CoverageReport:
|
|
branch_rate: float = 0.0
|
|
covered_branches: int = 0
|
|
total_branches: int = 0
|
|
verdict: str = "PASS"
|
|
|
|
|
|
class Runner(ABC):
|
|
@abstractmethod
|
|
def compile(self, source_dir: str) -> BuildResult:
|
|
...
|
|
|
|
@abstractmethod
|
|
def run(self, artifact: str, input_path: str, output_path: str) -> RunResult:
|
|
...
|
|
|
|
@abstractmethod
|
|
def get_coverage(self, artifact: str, run_id: str) -> CoverageReport:
|
|
...
|