Skip to content

Commit 0c9fd3f

Browse files
authored
Merge pull request #19 from sharpninja/copilot/get-real-benchmark-run
Clarify how to get a real benchmark run from Benchmark Comparison
2 parents 7338750 + b11e45b commit 0c9fd3f

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

.github/workflows/benchmark-comparison.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
else
8585
echo "BENCHMARK_EXTRA_ARG=--dry-run" >> "$GITHUB_ENV"
8686
echo "Benchmark secrets are unavailable; running benchmark comparison in dry-run mode." >> "$GITHUB_STEP_SUMMARY"
87+
echo "To run the real benchmark, add these secrets and rerun the workflow: OPENAI_API_KEY, GRAPHRAG_API_BASE, AZURE_AI_SEARCH_URL_ENDPOINT, AZURE_AI_SEARCH_API_KEY." >> "$GITHUB_STEP_SUMMARY"
88+
echo "You can trigger a rerun from Actions → Benchmark Comparison → Run workflow once the secrets are configured." >> "$GITHUB_STEP_SUMMARY"
8789
fi
8890
8991
- name: Benchmark Python implementation

scripts/benchmark_smoke.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,11 @@ def summarize_results(results: list[OperationResult]) -> dict[str, int]:
374374
return summary
375375

376376

377+
def has_dry_run_results(*result_groups: list[OperationResult]) -> bool:
378+
"""Return whether any result group contains dry-run benchmark results."""
379+
return any(result.status == "dry_run" for results in result_groups for result in results)
380+
381+
377382
def render_markdown_report(
378383
python_results: list[OperationResult],
379384
dotnet_results: list[OperationResult],
@@ -399,6 +404,18 @@ def render_markdown_report(
399404
f"{summary.get('dry_run', 0)} |"
400405
)
401406

407+
if has_dry_run_results(python_results, dotnet_results):
408+
lines.extend(
409+
[
410+
"",
411+
"> [!IMPORTANT]",
412+
"> This comparison used `--dry-run`, so it validated commands without executing the real benchmark workload.",
413+
"> To get a real benchmark run in GitHub Actions, configure these secrets and rerun the `Benchmark Comparison` workflow:",
414+
"> `OPENAI_API_KEY`, `GRAPHRAG_API_BASE`, `AZURE_AI_SEARCH_URL_ENDPOINT`, and `AZURE_AI_SEARCH_API_KEY`.",
415+
"> You can rerun it manually with **Actions → Benchmark Comparison → Run workflow** after those secrets are available.",
416+
]
417+
)
418+
402419
lines.extend(
403420
[
404421
"",

tests/unit/test_benchmark_smoke.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,30 @@ def test_render_markdown_report_includes_missing_output_notes():
9090
assert "extract_graph_nlp" in report
9191

9292

93+
def test_render_markdown_report_explains_how_to_get_real_benchmark_run():
94+
module = load_module()
95+
96+
dry_run_result = module.OperationResult(
97+
implementation="python",
98+
fixture="text",
99+
operation_type="index",
100+
operation_label="index:fast",
101+
method="fast",
102+
query=None,
103+
command=["uv", "run", "python", "-m", "graphrag", "index"],
104+
duration_seconds=0.0,
105+
exit_code=0,
106+
status="dry_run",
107+
stdout="[dry-run]",
108+
)
109+
110+
report = module.render_markdown_report([dry_run_result], [])
111+
112+
assert "This comparison used `--dry-run`" in report
113+
assert "OPENAI_API_KEY" in report
114+
assert "Run workflow" in report
115+
116+
93117
def test_python_query_command_uses_cli_shape_from_fixture():
94118
module = load_module()
95119
repo_root = Path(__file__).resolve().parents[2]

0 commit comments

Comments
 (0)