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

Build/publish artifacts - musl, zigbuild and cloudsmith #1712

Merged
merged 6 commits into from
Feb 8, 2023

Conversation

reubenmiller
Copy link
Contributor

Proposed changes

This PR is a bit cross cutting as there are three topics wrapped into one, but all of them relate to the building/publishing of the artifacts. I would like to push the topics in one go, rather than having 3 dependent PRs (but I am happy to change this if there are objections).

The following changes are included:

  • Use cargo-zigbuild for building artifacts as it makes it easier to cross compile on various sources and targets (e.g. MacOS M1, Linux x86_64 etc.)
    • Checkout out the blog post describing some of the motivation and challenges with cross compiling in rust
  • Build musl variants (see next section for more details on why)
  • Simplify the build-workflow to use one matrix job for all targets (instead of one job for x86_64, then a matrix job for the others
  • Publish artifacts to Cloudsmith (instead of JFrog)
    • Only build/publish on main branch and tags (as our version numbering is tag based).

Why use musl variants instead of gnu?

  • No dependencies (static binary), no dependency on gnu glibc (yes this was in there my default, and sometimes caused issues deploying on older Linux distributions.
  • Better compatibility with different Linux distributions, namely Alpine Linux (which does not have gnu libc)

Downsides of the musl variants:

  • Slightly larger binaries on some architectures. On average a 5% increase in binary size. However worst case, for users that that need the smallest possible binary, they can build the project themselves, and use one of the gnu targets (as the build process is the same)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
@reubenmiller reubenmiller added improvement User value ci/cd Repository management and pipeline topics theme:packaging Theme: Packaging and release artefact topics labels Feb 6, 2023
@reubenmiller
Copy link
Contributor Author

⚠️ Warning ⚠️
Additional testing is required to ensure there are no surprises when switching to the musl variants before this PR is merged.

Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved the changes to cross-compile using zig.

I only got quick glance on the part related to Cloudsmith.

@reubenmiller
Copy link
Contributor Author

Approved the changes to cross-compile using zig.

I only got quick glance on the part related to Cloudsmith.

I will have a dedicated session detailing the Cloudsmith part (to double check the repo structure etc.). Though it does follow the same structure as JFrog (more or less).

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
@reubenmiller
Copy link
Contributor Author

reubenmiller commented Feb 7, 2023

Testing update / todo

The following targets should be tested on real devices:

  • x86_64-unknown-linux-musl
  • aarch64-unknown-linux-musl
  • armv7-unknown-linux-musleabihf
  • arm-unknown-linux-musleabihf

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
@reubenmiller reubenmiller merged commit 6e71883 into thin-edge:main Feb 8, 2023
@reubenmiller reubenmiller deleted the feat-default-musl-builds branch February 8, 2023 14:30
@reubenmiller reubenmiller added this to the 0.10.0 milestone Feb 10, 2023
Bravo555 pushed a commit to Bravo555/thin-edge.io that referenced this pull request Feb 14, 2023
* use cargo-zigbuild for building
* build musl variant by default
* split build and publish jobs

---------

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd Repository management and pipeline topics improvement User value release:highlight theme:packaging Theme: Packaging and release artefact topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants