Skip to content

[v0.2.0] Refactor CI into reusable workflow #75

Description

@neverDefined

Problem

.github/workflows/ci.yml defines three jobs (test, vuln, lint) inline. If a sister repo or fork wants the same setup, they re-implement it. A reusable workflow makes the surface composable.

Proposal

Split ci.yml into:

  • .github/workflows/_test.yml — reusable, takes os and go-version inputs, runs the test job.
  • .github/workflows/_lint.yml — reusable, runs lint + govulncheck.
  • .github/workflows/ci.yml — top-level, calls the reusable workflows for the matrix.

Pattern (per GitHub docs):

# ci.yml
jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest]
        go: ['1.25', '1.26']
    uses: ./.github/workflows/_test.yml
    with:
      os: ${{ matrix.os }}
      go-version: ${{ matrix.go }}

Acceptance criteria

  • Existing 3-job structure preserved (test matrix, vuln, lint all run).
  • Reusable workflows callable from sister repos via uses: neverDefined/go-anvil/.github/workflows/_test.yml@v0.2.0.
  • Document the call signature in CONTRIBUTING.md.

Out of scope

Don't migrate to a third-party action like nektos/act or similar. Stay on stock GitHub Actions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ciGitHub Actions, release automationtype:choreHousekeeping, no user-visible change

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions