Skip to content

ci: enforce cached, Windows-tuned Go setup repo-wide - #147

Merged
bigboateng merged 1 commit into
mainfrom
ci-speed-policy
Jul 23, 2026
Merged

ci: enforce cached, Windows-tuned Go setup repo-wide#147
bigboateng merged 1 commit into
mainfrom
ci-speed-policy

Conversation

@bigboateng

Copy link
Copy Markdown
Contributor

Why

go test/go build on windows-latest runs ~9m25s while the same jobs take
seconds on Linux/macOS. setup-go is only ~7s — the dominant cost is Microsoft
Defender real-time scanning of the many small object/link files the Go toolchain
writes during compile/test. No workflow had build caching or Defender exclusions.

What

Shared composite action — .github/actions/go-setup

  • On Windows: Add-MpPreference -ExclusionPath for GOCACHE (%LOCALAPPDATA%\go-build),
    GOPATH/GOMODCACHE (%USERPROFILE%\go), the workspace, and RUNNER_TEMP, plus
    -ExclusionProcess go.exe. Wrapped in try/catch so it degrades gracefully.
  • Always: actions/setup-go@v7 with module + build caching (keyed on go.sum
    where one exists, else go.mod).

Routed every Go job through itboatstack-lab, pitot-lab, conformance,
deltawire-v7, deltawire-v8. The deltawire builds are reproducible
(-trimpath -buildvcs=false, pinned GOOS/GOARCH/CGO) and remain sha256-locked;
their existing lock checks validate byte-identical output in this PR.

Repo-wide enforcement — the policy is structural, not a thing to remember

  • .github/scripts/lint_go_ci_policy.py: any job whose run: steps invoke
    go test|build|run|vet|install must include a step that uses: the shared
    action. Escape hatch: # ci-speed-policy: exempt(<reason>) (reason required).
  • .github/workflows/ci-policy.yml runs the lint on any .github/** change.

Verification

  • Lint passes locally over all 18 workflows; negative test confirms it flags a
    non-compliant job and honors the exempt marker.
  • Watch this PR's CI: boatstack-lab / pitot-lab Windows Runtime job time
    (expected large drop), deltawire v7/v8 sha-locks still green, CI speed policy
    green.

Follow-up (separate public-repo PR): inline the same Defender + cache steps into
operatorstack/boatstack's hand-maintained ci.yml (can't reference this
repo's local action).

Windows go test/build is dominated by Microsoft Defender scanning the
many small files the Go toolchain emits (~9m on windows-latest vs seconds
elsewhere). Introduce a shared composite action that adds Defender
exclusions (GOCACHE/GOMODCACHE/workspace + go.exe) plus module/build
caching, and route every Go job through it.

- .github/actions/go-setup: composite (Defender exclusions on Windows +
  actions/setup-go@v7 with cache).
- Convert boatstack-lab, pitot-lab, conformance, deltawire-v7/v8 to it.
- Add a repo-wide lint (scripts/lint_go_ci_policy.py + ci-policy.yml):
  any job running go test/build/run/vet must use the shared action, so
  caching is structural, not something to remember. Escape hatch:
  '# ci-speed-policy: exempt(<reason>)'.
@bigboateng
bigboateng merged commit 42d7f2d into main Jul 23, 2026
14 checks passed
@bigboateng
bigboateng deleted the ci-speed-policy branch July 23, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant