Skip to content

ci: collapse the duplicated verify steps in pr.yml and release.yml into a reusable workflow #9

Closed

Description

@necrophidia

Problem

pr.yml's build-and-lint job and release.yml's verify job now run the same checks, declared twice. Raised during review of #8, where the verify job was added so that a push to main cannot publish an immutable proxy.golang.org tag from code nothing verified.

As of ec06c1d, comparing the two parsed workflows:

Step pr.yml / build-and-lint release.yml / verify
actions/checkout@v4 ✅ ✅ identical
actions/setup-go@v5 ✅ ✅ identical
Build ✅ ✅ identical
Vet ✅ ✅ identical
Test go test -race -coverprofile=coverage.out ./... go test -race ./...
Coverage go tool cover -func=coverage.out (absent)
Lint ✅ ✅ identical
Shellcheck release scripts ✅ ✅ identical
Test release versioning ✅ ✅ identical

Seven of the eight shared steps are byte-identical; the two differences are deliberate (the release path has no reason to print a coverage report). But that is already the shape of drift, and the failure mode is asymmetric: if someone adds a check to pr.yml and forgets release.yml, the gap is invisible until a tag is published from code that check would have caught — and a module proxy tag cannot be withdrawn.

The pinned linter version is a concrete example. It appears in both files as v2.13.2, so bumping it means remembering both.

Suggested fix

Extract the shared steps into a reusable workflow called by both:

# .github/workflows/verify.yml
on:
  workflow_call:
    inputs:
      coverage:
        type: boolean
        default: false

pr.yml calls it with coverage: true; release.yml calls it with the default and keeps needs: on the calling job. The linter version becomes a single env: entry.

Why not in #8

That PR is already large, and the release gate is one of the things under review there — adding a layer of workflow indirection to the same diff would make the gate harder to verify, which is the opposite of what the change is for. Better done on its own, where the only question is whether the two callers still run what they ran before.

Acceptance

  • pr.yml and release.yml declare no duplicated build/test/lint steps.
  • The linter version is pinned in one place.
  • A pull request still reports coverage; the release path still gates tagging on the same checks.
  • next-version_test.sh and shellcheck still run on both paths.

🤖 Generated with Claude Code

Activity

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