Skip to content

Refactor ci.skeleton.yaml to eliminate template duplication #12

@tsavo-at-pieces

Description

@tsavo-at-pieces

Overview

File: `templates/github/workflows/ci.skeleton.yaml`

The skeleton template has two nearly identical blocks: `single_platform` (lines 41-149) and `multi_platform` (lines 151-307). The checkout, git config, dart setup, cache, protobuf, and analysis steps are copy-pasted between them. The only structural difference is that multi-platform splits `analyze` and `test` into separate jobs with a matrix.

Risk

Any bug fix or improvement to a shared step must be made in two places. History shows these drift — it's exactly the kind of duplication that causes "fixed on ubuntu but not on windows" bugs.

Examples of recent or potential drift:

  • Cache key format (currently identical, but if one is updated and not the other...)
  • Action versions (checkout, setup-dart, cache)
  • Git config organization list
  • Token handling

Potential Approaches

  1. Mustache partials — Extract shared step sequences into partial templates
  2. Programmatic YAML builder — Build the YAML in Dart code, composing shared steps
  3. Single template with conditional job splitting — More complex Mustache logic but one source of truth

Acceptance Criteria

  • Shared steps defined in exactly one place
  • Both single-platform and multi-platform paths still produce correct output
  • Existing tests (once written per issue #XX) still pass
  • Consumer workflows regenerate identically

Metadata

Metadata

Labels

P2-mediumMedium priorityarea/templateTemplate engine and skeleton filesenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions