benchmark-action / benchmark-action/github-action-benchmark
refactor(ci): extract shared benchmark-job setup into composite action / workflow_call
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 1.3k
- Fork
- 183
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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-repositoryinput on the action (results-repo case)- Validate-script third arg (
./benchmark-data-repository) - Token used (default
GITHUB_TOKENvsBENCHMARK_ACTION_BOT_TOKEN)
22 jobs share ~80% of their YAML.
Problem
- Any change (e.g. node version bump, action input, validate command shape) must be replicated 11–22 times.
- #354 itself touched this duplication (drop
Save previous data.js× 22, plus add fetch step × 11). Future similar changes will keep paying the same tax.
Proposal
Two paths, pick one:
- Composite action at
.github/actions/setup-bench/action.yml— wrapsactions/checkout,setup-node,npm ci,npm run build. Each job callsuses: ./.github/actions/setup-benchthen runs its tool-specificRun benchmarkstep plusStore benchmark result. workflow_callreusable workflow with matrix over(tool, target_repo). Single source of truth; atoolvalue selects which benchmark-runner step to use;target_reposelects gh-repository / token / validate-arg.
(2) collapses both YAML files into one. Bigger refactor but eliminates the file split entirely.
Out of scope
- The actual race fix in #354 (already done).
- Anything that changes runtime semantics — refactor must be behavior-preserving.
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia confrontando .github/workflows/ci.yml e .github/workflows/ci-results-repo.yml, concentrandoti sui passaggi duplicati di setup, benchmark, result-storage e validation. Valuta le proposte composite-action e workflow_call rispetto ai loro diversi input per repository, token e validazione. Il lavoro è completato quando i workflow sono sostanzialmente più piccoli, un nuovo strumento richiede al massimo una voce di job e tutti i 22 job esistenti continuano a superare i test senza modifiche a runtime.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github-actions, nodejs, yaml
- Ambito
- build-system, ci-cd
- Tipo di issue
- Refactoring
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 52/100