ci: enforce cached, Windows-tuned Go setup repo-wide - #147
Merged
Conversation
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>)'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
go test/go buildonwindows-latestruns ~9m25s while the same jobs takeseconds on Linux/macOS.
setup-gois only ~7s — the dominant cost is MicrosoftDefender 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-setupAdd-MpPreference -ExclusionPathforGOCACHE(%LOCALAPPDATA%\go-build),GOPATH/GOMODCACHE(%USERPROFILE%\go), the workspace, andRUNNER_TEMP, plus-ExclusionProcess go.exe. Wrapped in try/catch so it degrades gracefully.actions/setup-go@v7with module + build caching (keyed ongo.sumwhere one exists, else
go.mod).Routed every Go job through it —
boatstack-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 whoserun:steps invokego test|build|run|vet|installmust include a step thatuses:the sharedaction. Escape hatch:
# ci-speed-policy: exempt(<reason>)(reason required)..github/workflows/ci-policy.ymlruns the lint on any.github/**change.Verification
non-compliant job and honors the exempt marker.
boatstack-lab/pitot-labWindowsRuntimejob time(expected large drop), deltawire v7/v8 sha-locks still green,
CI speed policygreen.
Follow-up (separate public-repo PR): inline the same Defender + cache steps into
operatorstack/boatstack's hand-maintainedci.yml(can't reference thisrepo's local action).