Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reduce executable size #64

Merged
merged 2 commits into from
Apr 25, 2024
Merged

feat: reduce executable size #64

merged 2 commits into from
Apr 25, 2024

Conversation

YOU54F
Copy link
Member

@YOU54F YOU54F commented Apr 25, 2024

Slim executables

[profile.release]
strip = true
opt-level = "z"
codegen-units = 1
lto = true

References

Motivation

Some of our client languages necessitate the inclusion of all supported platform/architecture combinations in a single package distributed to end-users.

Reducing the size of the executables and libraries if preferable, if there is no discernible difference for end user.

The proposed set of changes, opts not to set panic=abort over the default of panic=unwind.

The inclusion of the panic=abort will change behaviour which may lead to changes in how we program (if we are expecting to be able to unwind - maybe more relevant for the ffi?), but leads to smaller binary sizes. To go further than that, we need to build against nightly rust channels, which is probably less than preferable.

I believe these set of options provides the best trade-offs whilst remaining on a stable rust channel.

The strip option as a minimum should be included, it is actually now enabled by default in rust 1.77, related issue

rust-lang/cargo#4122

- create linux executables linked statically to musl
  - drop gnu (glibc) target, executable will work on alpine & glibc based distros (debian etc)
- create windows aarch64 target
  - required update to Cargo.lock to update ring to v0.17 due to build failures on v0.16
- refactor release script & workflow to match pact-reference
  - builds on pull request to master/main branch, in debug mode
- add Docker automated pipeline during release
  - publish multi-arch amd64/arm64
  - publish to DockerHub
  - publish to GitHub container registry

Related epics

- musl all the things
  - pact-foundation/roadmap#30
- publish to github container registry
  - pact-foundation/roadmap#29
@YOU54F YOU54F changed the title Feat/reduce exe size feat: reduce executable size Apr 25, 2024
@rholshausen rholshausen merged commit bbc107c into master Apr 25, 2024
11 checks passed
@rholshausen rholshausen deleted the feat/reduce_exe_size branch April 25, 2024 23:49
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.

2 participants