Skip to content

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

Open
cafferata wants to merge 2 commits intoStackExchange:mainfrom
cafferata:cicd/goreleaser-single-target
Open

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

Conversation

@cafferata
Copy link
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
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%

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?

1 participant