Skip to content

BUILD: Speed up GoReleaser in PR builds with --single-target --skip=before#4167

Merged
tlimoncelli merged 2 commits intoStackExchange:mainfrom
cafferata:cicd/goreleaser-single-target
Mar 15, 2026
Merged

BUILD: Speed up GoReleaser in PR builds with --single-target --skip=before#4167
tlimoncelli merged 2 commits intoStackExchange:mainfrom
cafferata:cicd/goreleaser-single-target

Conversation

@cafferata
Copy link
Copy Markdown
Collaborator

The main bottleneck in the PR CI/CD pipeline is the goreleaser build --snapshot step, which takes ~8m19s out of the total ~10m45s (run 23057743439).

Step Duration
Unit tests 1m 46s
Build binaries (not tagged) 8m 19s
Rest (setup, cache, etc.) ~10s

Two things make it slow:

  1. Cross-compilation for all 8 targets (linux, windows, darwin, freebsd x amd64/arm64). For a PR build, we only need to verify the code compiles.
  2. Before hooks (go fmt ./..., go mod tidy, go generate ./...) run every time, but are redundant in CI -- formatting/tidy should already be done, and go generate is covered by the stringer install step.

This PR adds --single-target and --skip=before to the snapshot build, which should bring the GoReleaser step from ~8 minutes down to ~1 minute. The full release build (on tag) remains unchanged.

Fixes #4165

…for the runner's OS/arch (linux/amd64), skipping the other 7 targets.
…ndant `go fmt`, `go mod tidy`, `go generate hooks`.
@cafferata
Copy link
Copy Markdown
Collaborator Author

Results are in from run 23105587930:

Step Before After Difference
Build binaries (not tagged) 8m 19s 39s -93%
Unit tests 1m 46s 1m 47s -
Total ~10m 45s ~2m 52s -73%

@TomOnTime
Copy link
Copy Markdown
Collaborator

Amazing! Thank you so much! The difference between 8 and less than a minute is the difference between waiting vs. going to get a beverage. This is going to really help my productivity!

@tlimoncelli tlimoncelli merged commit ec4726b into StackExchange:main Mar 15, 2026
10 checks passed
@cafferata cafferata deleted the cicd/goreleaser-single-target branch March 15, 2026 17:09
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.

Can goreleaser run faster?

3 participants