Skip to content

refactor(ci): extract shared benchmark-job setup into composite action / workflow_call #355

@ktrz

Description

@ktrz

Context

Surfaced during review of #354. Both .github/workflows/ci.yml (11 jobs) and .github/workflows/ci-results-repo.yml (11 jobs) duplicate the same setup boilerplate across each tool's job: actions/checkout, actions/setup-node, npm ci, npm run build, Run benchmark, fetch gh-pages step (in ci.yml), Store benchmark result invocation, validate command. The two files differ only by:

  • gh-repository input on the action (results-repo case)
  • Validate-script third arg (./benchmark-data-repository)
  • Token used (default GITHUB_TOKEN vs BENCHMARK_ACTION_BOT_TOKEN)

22 jobs share ~80% of their YAML.

Problem

Proposal

Two paths, pick one:

  1. Composite action at .github/actions/setup-bench/action.yml — wraps actions/checkout, setup-node, npm ci, npm run build. Each job calls uses: ./.github/actions/setup-bench then runs its tool-specific Run benchmark step plus Store benchmark result.
  2. workflow_call reusable workflow with matrix over (tool, target_repo). Single source of truth; a tool value selects which benchmark-runner step to use; target_repo selects gh-repository / token / validate-arg.

(2) collapses both YAML files into one. Bigger refactor but eliminates the file split entirely.

Out of scope

Acceptance

  • ci.yml + ci-results-repo.yml shrink ~70%.
  • Adding a new benchmark tool requires ≤1 job entry, not ≥2.
  • All existing 22 jobs continue to pass.

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