Files
cleveragents-core/benchmarks/ci_yaml_parse_bench.py
T
brent.edwards e801eb1ee8 feat(ci): add nox-based PR validation workflow
- Rewrite .forgejo/workflows/ci.yml to route all jobs through nox sessions
- Fix coverage_report nox session: serial behave mode replaces broken parallel
  mode (22% -> 97% accuracy), raise fail-under from 85% to 97%
- Pass posargs through format nox session for CI --check support
- Add 11 CI workflow validation scenarios (Behave) + Robot smoke test + ASV bench
- Add 108 new Behave scenarios covering 6 largest coverage gaps to reach 97%:
  yaml_template_engine, actor/config, actor/registry, message_router,
  context_analysis, context_service
- Update docs/development/ci-cd.md with nox-based CI docs and 97% threshold
- Restore implementation_plan.md verbose style, check off completed CI tasks

Verified: 1673 scenarios pass, 97% coverage, lint clean, typecheck clean
2026-02-12 22:01:51 +00:00

45 lines
1.4 KiB
Python

"""Benchmarks for CI workflow YAML parsing and key lookup."""
from __future__ import annotations
from pathlib import Path
import yaml
CI_WORKFLOW_PATH = Path(".forgejo/workflows/ci.yml")
class CIYamlParseSuite:
"""Measure CI YAML parsing performance."""
def setup(self) -> None:
"""Read the raw YAML text once for reuse."""
if CI_WORKFLOW_PATH.exists():
self.yaml_text = CI_WORKFLOW_PATH.read_text()
else:
self.yaml_text = ""
def time_parse_ci_yaml(self) -> None:
"""Benchmark parsing the CI workflow YAML."""
if self.yaml_text:
yaml.safe_load(self.yaml_text)
def time_extract_job_names(self) -> None:
"""Benchmark extracting job names from parsed YAML."""
if self.yaml_text:
data = yaml.safe_load(self.yaml_text)
if data and "jobs" in data:
list(data["jobs"].keys())
def time_extract_nox_sessions(self) -> None:
"""Benchmark extracting nox session references from all steps."""
if self.yaml_text:
data = yaml.safe_load(self.yaml_text)
if data and "jobs" in data:
sessions: list[str] = []
for job_data in data["jobs"].values():
for step in job_data.get("steps", []):
run_cmd = step.get("run", "")
if "nox -s" in run_cmd:
sessions.append(run_cmd.strip())