Add build optimization flags to Makefile, CI, and e2e test helper#550
Merged
Add build optimization flags to Makefile, CI, and e2e test helper#550
Conversation
…e binary sizes Add -trimpath and -ldflags="-s -w" to all Makefile build targets and the e2e test binary builder, matching the flags already used by goreleaser for release builds. This strips the symbol table, DWARF debug info, and file system paths from binaries. Main binary size: 86MB → 62MB (~28% reduction) Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze build process to reduce binary output sizes
Add build optimization flags to Makefile and e2e test helper
Mar 9, 2026
- Fix Windows CI e2e build: add -trimpath -ldflags="-s -w" flags to match Linux/Makefile behavior (~15% faster build, ~28% smaller binary) - Switch goreleaser release format from raw binaries to compressed archives (tar.gz for Linux/macOS, zip for Windows) reducing release download size from 62MB to ~20MB per artifact (68% reduction) Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
Add build optimization flags to Makefile and e2e test helper
Reduce binary sizes: add build flags to Makefile/CI and compress release archives
Mar 9, 2026
Restores `formats: binary` instead of tar.gz/zip compressed archives, so release binaries are published directly without wrapping. Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com>
Copilot
AI
changed the title
Reduce binary sizes: add build flags to Makefile/CI and compress release archives
Add build optimization flags to Makefile, CI, and e2e test helper
Mar 9, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns non-release build paths (Makefile, CI, and e2e fallback builds) with GoReleaser’s existing optimization flags to reduce binary size and improve build/test speed across the project.
Changes:
- Add
GO_BUILD_FLAGS = -trimpath -ldflags="-s -w"and apply it to all Makefile build targets. - Update the e2e test helper’s fallback
go buildto use the same optimization flags. - Update the Windows CI e2e build step to pass the same flags.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
tests/e2e/internal/testutil/testutil.go |
Adds -trimpath and -ldflags to the fallback e2e build. |
Makefile |
Introduces and applies a shared GO_BUILD_FLAGS variable across build targets. |
.github/workflows/test.yml |
Adds optimization flags (and CGO setting) to the Windows e2e binary build step. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Align all build paths with goreleaser's existing optimization flags (
-trimpath -ldflags="-s -w") to reduce binary sizes ~28% (86MB → 62MB) and improve build/test speed ~15%.Changes
GO_BUILD_FLAGS = -trimpath -ldflags="-s -w"applied to all 6 build targetstestutil.go): Pass same flags inbuildBinary()so fallback test builds matchtest.yml): Add flags to the e2e binary build step — was the only build path still using barego buildWhat was evaluated and not changed
goreleaser.yaml: Already had-s -w -buildid= -trimpath— no changes needed. Release format kept asformats: binary(direct binaries, no archives).-buildvcs=false/-buildid=: Saves 36 bytes on top of-s -w— not worth the complexity.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.