Skip to content

refactor(ci): move benchmark orchestration into invokable Python #48

Closed

Description

@zackees

Context

The benchmark workflow in .github/workflows/benchmark-stats.yml currently contains substantial platform setup, artifact layout, history carry-forward, per-target aggregation, and publishing logic inline as shell/PowerShell steps. This makes the YAML difficult to review and prevents the same orchestration from being invoked locally or tested hermetically.

The benchmark parser and renderer already live in ci/benchmark_stats.py, while reld-bench emits one target-labelled markdown table. The 3-OS benchmark work in #45/#47 increases the amount of workflow logic and makes this boundary more urgent.

Proposal

Move benchmark orchestration into one or more invokable Python modules under ci/ (for example, a ci/benchmark_pipeline.py entry point). The GitHub Actions YAML should remain a thin runner adapter that installs platform tools, invokes the Python entry point, uploads artifacts, and performs only the minimal credentialed publish step. The Python entry point should own target configuration, log paths, history carry-forward, per-target rendering, artifact directory layout, and validation of expected outputs.

The script must support local invocation with explicit input/output paths and a no-publish mode, so contributors can exercise the aggregation and verify generated artifacts without GitHub Actions.

Acceptance criteria

  • The benchmark workflow YAML contains only thin platform adapters and calls the Python entry point for benchmark/aggregation orchestration; duplicated target lists and output-layout logic are removed from YAML.
  • The Python entry point supports all three targets currently defined by the benchmark matrix: Linux, Windows MSVC, and macOS arm64.
  • Local invocation can consume supplied raw logs and history directories, render each target into its own output directory, and run without GitHub credentials or publishing.
  • The script validates that every target produces latest.json, history.jsonl, benchmark-link.jpg, and index.html, and fails clearly when a raw log is missing or malformed.
  • The default-branch publish guard remains intact and no branch push occurs in local/no-publish mode.
  • Add focused Python tests that demonstrate RED on the current inline-only workflow contract and GREEN after the refactor, including target isolation and missing-input failures.
  • Run the focused tests plus the existing benchmark-statistics test suite, and document a local command that exercises the aggregation path.

Open questions

  • Whether platform installation should remain entirely in YAML or be represented by a small Python command abstraction; the implementation should keep OS-native package installation readable and secure.
  • Whether to retain benchmark_stats.py as the renderer API or split orchestration and rendering into separate modules; avoid changing the published JSON schema unless required.

Related issues

Activity

  1. zackees commented on Sep 17, 2026

    @zackees
    CollaboratorAuthor

    Done in PR #162, which merged into #161's branch and landed on main as bf69781 — GitHub did not auto-close it because the PR's base was the stacked branch rather than main.

    ci/benchmark_pipeline.py now owns target configuration, the benchmark-log-<target>/ input layout, history carry-forward, per-target rendering, the combined page, and validation that every target produced latest.json, history.jsonl, benchmark-link.jpg and index.html. The workflow step is one call; publishing and its default-branch guard stay in YAML, where the token is.

    Local command, no credentials and no network:

    uv run --no-sync python -m ci.benchmark_pipeline \
        --input-root benchmark-input --output-root benchmark-stats --no-history-fetch
    

    The two workflow-contract tests that asserted the old inline shell were the RED half and now assert the new contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions