Skip to content

Conversation

@Edouard-chin
Copy link
Member

I'm currently working on a tool to help the Ruby community ship gems with precompiled binaries with the intent to make bundle install much faster for everyone.
I see that this gem already ships with precompiled binaries using rake-compiler-dock. We are trying to introduce a new way to precompile binaries with a simpler native compilation toolchain.

cibuildgem modestly tries to follow the same approach as what the python community did with cibuildwheel.

The CI workflow in this commit was generated with the cibuildgem CLI which reads the gemspec and determine what ruby versions needs to be compiled and tested against. This is the resulting CI run when a release is about to be made: https://github.com/Shopify/blake3-rb/actions/runs/19982670343

The TL;DR on how it works:

  1. We compile natively on each platform and upload the staging files to GitHub.
  2. We create a matrix for testing purposes (platform/ruby version/type).
  3. If 2) succeeds we check whether the gems with precompiled binaries are installable, and whether the "vanilla" gem can be installed.
  4. [OPTIONAL] By ticking a box on the GitHub UI, you can tell the GitHub action to do the release of the gems. We use RubyGems trusted publishing for this.

Advantages

  • No extra setup
  • It's not required to build your CI workflow from scratch
  • The CI workflow makes more checks to ensure that the gems are installable and the test suite passes on the precompiled binaries.
  • You can now ship the gems directly with the GitHub action (no need to use shipit, download the gems and do the release).

Disadvantages compare to rake-compiler-dock

  • We currently don't support linux musl nor linux 32 bits (but we have plan to in the future!)

- The issue being that the resulting binary should be placed in that
  folder but it doesn't exist.
- This is due to an incompatibility related to the precompiled ruby
  we use that was built with the msys2 toolchain while rb-sys will
  try to compile by default using the mscv toolchain.
@Edouard-chin Edouard-chin requested a review from ianks December 6, 2025 04:32
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.

1 participant