Add pure ruby platform gem variant for rspec-trunk-flaky-tests#1060
Add pure ruby platform gem variant for rspec-trunk-flaky-tests#1060trunk-io[bot] merged 5 commits intomainfrom
Conversation
Users with `PLATFORMS ruby` in their Gemfile.lock cannot install the gem because only platform-specific precompiled variants are published. This adds a ruby platform fallback that compiles the native extension from source on install. Changes: - Rakefile: add `ruby_gem` task to build the pure ruby platform gem - release_ruby_gem.yml: add `ruby-gem` job to build and publish the ruby variant alongside the cross-compiled platform gems - Gemfile.lock: add `ruby` to PLATFORMS https://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD
|
😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details. |
Verifies the built gem has platform=ruby, includes the extconf.rb extension for source compilation, and contains the expected Rust source files, Cargo.toml, and Ruby lib files. https://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD
Move the ruby platform gem build from a separate job into the existing cross-gem matrix as another platform entry. Uses conditionals to skip cross-compilation steps for ruby and run gem build + validation instead. Eliminates duplicated version update steps. https://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD
The ruby platform gem cannot compile from source because the Rust
extension depends on monorepo-local path crates. Instead, ship a
ruby variant that only contains lib/*.rb with no extensions or native
source. If loaded on a platform without a precompiled native gem, it
raises a clear error explaining how to add the correct platform:
bundle lock --add-platform x86_64-linux
This unblocks users who have `PLATFORMS ruby` in their Gemfile.lock —
bundler can resolve the dependency, and on supported platforms it will
always prefer the precompiled native gem.
https://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD
Do these two contradict one another - won't the error only be raised if an install is happening on an unsupported platform, and in that case there is nothing the user can do? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1060 +/- ##
==========================================
+ Coverage 81.70% 81.96% +0.26%
==========================================
Files 69 69
Lines 14878 14878
==========================================
+ Hits 12156 12195 +39
+ Misses 2722 2683 -39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The previous message told users to add their platform, which doesn't help if they're on an unsupported platform. Updated to explain that the ruby gem is a placeholder for Gemfile.lock resolution, distinguish between the "supported platform but wrong variant selected" case and the "unsupported platform" case, and point to the issue tracker. https://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD
|
@jjb yeah, that was a bad message. I've updated to be more specific, and I'm happy to change it if there's something you think would make it clearer. Thanks for reviewing! |
TylerJang27
left a comment
There was a problem hiding this comment.
LGTM. Next step is testing a beta release
|
🎉 |
Summary
Adds a pure
rubyplatform gem variant so users withPLATFORMS rubyin their Gemfile.lock can resolve the dependency without manually adding every CI platform.The ruby gem is a lightweight fallback — it contains only the Ruby lib files (no native extension, no Rust source, no
rb_sysdependency). On supported platforms, bundler automatically prefers the precompiled native gem. If the ruby variant is loaded on a platform without a native gem, it raises a clear error:Why not compile from source?
The Rust native extension depends on monorepo-local path crates (
context,test_report) that aren't available to end users, so source compilation would always fail.Changes
lib/rspec_trunk_flaky_tests.rb— CatchLoadErrorfrom missing native extension and raise a helpful message with platform instructionsRakefile—ruby_gemtask builds a gem with no extensions, no native source, norb_sysdep — justlib/**/*.rbrelease_ruby_gem.yml— Addrubyto thecross-gemmatrix with conditional steps to build and validate the ruby variantGemfile.lock— Addrubyto PLATFORMSTest plan
platform=ruby, no extensions, no.rsfiles, norb_sysdeplib/rspec_trunk_flaky_tests.rbandlib/trunk_spec_helper.rbcross-gemmatrix builds all 5 variants (4 native + ruby)gem pushpublishes all variantshttps://claude.ai/code/session_01NmPAFvW2QgLBjsocytoVLD