Repository navigation
Install a prebuilt extension from the GitHub release when Cargo is missing - #190
Merged
Merged
Conversation
…ssing thermite's fallback for machines without Rust came back as part of the gem: the release workflow now builds the extension for Ruby 3.4 on Linux x86_64, macOS arm64 and x86_64, and Windows x64, packs each as `faster_path-<gem version>-ruby<XY>-<os>-<cpu>.tar.gz` with a SHA-256 file (`rake prebuilt`), and attaches them and the gem to the release of a version tag; it can also be run by hand to check the builds before tagging. At `gem install`, ext/Rakefile builds with Cargo when it is found, and otherwise downloads the asset for the running Ruby from the release, checks it against its checksum and unpacks the library into lib/faster_path; with no asset for the platform it fails naming the file it looked for. FASTER_PATH_PREBUILT_URL points the download elsewhere. The names carry the gem's version and the Ruby's minor version, so one build serves every patch release of that Ruby; thermite's names carried the exact patch release and only matched that one. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CXvfgWzuq28ewqT3AyhX4Z
Changed Files
|
0.5.0 is published without the prebuilt extension support, so the release that carries the prebuilt extensions is 0.5.1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CXvfgWzuq28ewqT3AyhX4Z
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.
Brings back the no-Rust install path that went with thermite, as part of the gem itself, and the release job that feeds it.
Release side
rake prebuiltbuilds the extension and packs it asfaster_path-<gem version>-ruby<XY>-<os>-<cpu>.tar.gz(e.g.faster_path-0.5.0-ruby34-linux-x86_64.tar.gz, holdinglib/faster_path/libfaster_path.so) with a.sha256file next to it, inpkg/.prebuiltCI job runs it for Ruby 3.4 on ubuntu-22.04 (linux-x86_64), macos-latest (darwin-arm64), macos-15-intel (darwin-x86_64) and windows-latest (windows-x86_64), one Ruby per OS as agreed. It runs forv*tags and onworkflow_dispatch, so the builds can be checked before tagging.releasejob (tags only) builds the.gemand attaches it and the four tarballs with their checksums to the GitHub release.Install side
ext/Rakefilebuilds with Cargo when it is found (as before). When it isn't, it downloads this version's asset for the running Ruby from the GitHub release, verifies the SHA-256, unpacks the library intolib/faster_path/and the gem loads it from there. With no asset for the platform, the install fails with a message naming the file it looked for and pointing at the Rust installer.FASTER_PATH_PREBUILT_URLreplaces the release URL (mirrors, offline machines). All stdlib:Net::HTTP(following GitHub's redirects),Gem::Package::TarReader,Zlib,Digest.The names carry the gem's version and the Ruby's minor version, so one build serves every patch release of that Ruby. thermite's names carried the exact patch release (
ruby2.7.8), so they only ever matched that one.Verification
rake minitest lintpasses (145 tests, including pack/unpack round-trip, checksum rejection and Cargo detection);rake prebuiltproduces the tarball and checksum.PATHand a local HTTP server standing in for the release: on Ruby 3.4gem installprints "Cargo was not found; downloading the prebuilt extension", installs a 780 KB gem andrequire 'faster_path'works; on Ruby 3.2 (noruby32asset) it fails with the message above.prebuiltjob on all four runners is best checked with aworkflow_dispatchrun once this is merged, before tagging v0.5.0.Generated by Claude Code