Repository navigation
build: precompiled x86_64-linux and aarch64-linux platform gems - #6
gmiklos-ltg wants to merge 27 commits into
Conversation
Adds `rake gem:native:x86_64-linux`, which downloads the Apache archive's
x86_64 libpulsar debs, compiles bindings.so against them, vendors
libpulsar.so into lib/pulsar/, and packages a Gem::Platform.new("x86_64-linux")
gem with no extensions - so installing it needs no C++ toolchain or system
libpulsar.
The vendored libpulsar.so is found at runtime via a new -Wl,-rpath,'$ORIGIN'
link flag in ext/bindings/extconf.rb (harmless for a normal from-source
build: it's just an extra search path that resolves to nothing when there's
no libpulsar.so sitting next to bindings.so).
Verified locally end-to-end: built the gem, installed it into a clean
GEM_HOME, moved /usr/lib/libpulsar.so and /usr/include/pulsar out of the
way entirely, then required the gem, constructed a Pulsar::Client, and ran
the full non-broker spec suite against the installed gem's own
bindings.so/libpulsar.so (42 examples, 0 failures, 3 pending) - all with
zero libpulsar present anywhere on the system.
Scoped to x86_64-linux for now (Phase 1); aarch64-linux is a near-identical
follow-up (deb-arm64 + an arm64 runner) once this is proven in CI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Builds the x86_64-linux precompiled gem (rake gem:native:x86_64-linux), then in a separate job installs it into genuinely clean ubuntu:22.04 and ubuntu:24.04 containers - no libpulsar, no C++ toolchain - and runs the non-broker spec suite against the installed artifact, not the build tree. Matches exactly what was verified locally in this session (gem install + rspec, no bundler, with /usr/lib/libpulsar.so and /usr/include/pulsar removed from the system first). workflow_dispatch only for now - this is this repo's first CI of any kind, being proven out before anything (e.g. a tag push) triggers a real `gem push` to GitHub Packages. Also: README documented a precompiled-gem install path via GitHub Packages, and dropped a stale "no longer under active development / archived" banner left over from before this fork resumed active work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
… PR #6 workflow_dispatch requires the workflow file to already be on the default branch before GitHub will let it be invoked, which this PR hasn't merged yet. pull_request doesn't have that restriction - it runs using the workflow as it exists on the PR's own branch - so this gets a real CI run without merging first. Revisit (drop pull_request, or keep it as permanent per-PR coverage) once that run is verified. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
First real workflow_dispatch^H^H pull_request-triggered run failed in both smoke-test legs: ruby/setup-ruby's prebuilt Ruby needs libyaml-0.so.2 for psych (YAML) at runtime, which is present on GitHub's full hosted runner images by default but missing from a bare ubuntu: container. Confirmed this is a universal Ruby dependency, not specific to the prebuilt binary, by checking our own from-source Ruby 3.4.13 build's psych.so - it links libyaml-0.so.2 too. Unrelated to the gem itself: still no build-essential, no gcc, no libpulsar installed in these containers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Second real CI run got further (libyaml fix worked) but failed differently: gem install --local couldn't resolve 'rice (~> 2.1)', inherited unchanged from the source gemspec. Both rice and rake-compiler are build-time only (extconf.rb's require "mkmf-rice", Rake::ExtensionTask) - nothing at runtime needs either, and the platform gem ships no extensions to build, so neither belongs in its dependency list. Confirmed no lib/**/*.rb requires "rice", and re-verified the full local rehearsal end to end (install --local, system libpulsar removed, require + construct client + 42 examples/0 failures/3 pending) with this fix in place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Rakefile: one-line addition to NATIVE_GEM_PLATFORMS ("aarch64-linux" =>
"deb-arm64") - build_native_gem was already written to take
platform/deb_dir as parameters, so no other Rakefile changes needed.
Workflow: restructured both jobs into explicit include: matrices (avoids
invalid platform/runner/image combinations a plain cross-product would
allow). build now has a second leg on ubuntu-22.04-arm (GitHub's native
arm64-hosted runner - builds natively, no QEMU cross-compilation).
smoke-test is now a 4-way matrix: both platforms x both Ubuntu versions,
each running its container on a matching-arch runner so Docker pulls the
right-arch image and the gem's .so runs natively, same verification shape
as Phase 1 (clean container, no libpulsar, no toolchain, install + require
+ construct client + non-broker specs).
Re-verified the x86_64-linux path still builds correctly locally after
this change (this sandbox is x86_64, so it can't build or run an aarch64
.so - that side can only be proven by the arm64 runner itself, same as
Phase 1's container-based smoke test could only be proven in real CI).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Proved its worth catching 3 real bugs pre-merge across the x86_64 and aarch64 verification passes. Scoped with paths: to the files that actually affect this pipeline (Rakefile, ext/**, pulsar-client.gemspec, the workflow itself) so it only runs on PRs that could plausibly break it, not on unrelated changes like a README fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
zsbutosi
left a comment
There was a problem hiding this comment.
Thanks — the overall approach (vendor one self-contained libpulsar.so and find it through a $ORIGIN rpath) is right, and the $$ORIGIN quoting in extconf.rb is correct. Requesting changes for two blockers and one probable security issue:
- F1 (High): the precompiled gem still depends on
rice, which has to be compiled, so installing it still needs a C++ toolchain. - F2 (High): there's no
required_ruby_version, so the Ruby 3.4-onlybindings.sogets picked on any Ruby. - F3 (Medium, security): the temporary
/tmpbuild folder is probably saved inbindings.so's RUNPATH ahead of$ORIGIN. Please check withreadelf -d.
Smaller items (F4–F8) are inline: the README's Gemfile requirement and fallback claim, unverified downloads, the smoke test loading the repo's own Ruby files, the workflow trigger and permissions, and binaries left in the working tree.
Three real findings from a fresh review pass, each confirmed before fixing: - No integrity check on the downloaded .debs, and curl lacked -f (a 404 silently saves an HTML error page as the .deb, surfacing later as a confusing dpkg-deb error instead of a clear download failure). Pinned each artifact's real SHA-512 (fetched fresh from Apache's own .sha512 sidecar files) next to PULSAR_CPP_VERSION and verify before extracting. - readelf -d showed the shipped bindings.so's RUNPATH was [<ci-ruby-libdir>:<ephemeral-tmp-build-path>:$ORIGIN], not just $ORIGIN - both baked-in entries are meaningless (and the tmp path leaks build-host structure) on a consumer's machine. patchelf --set-rpath '$ORIGIN' now strips to exactly $ORIGIN, asserted via patchelf --print-rpath; re-ran the full install/require/construct-client check afterward to confirm it still works. - bindings.so links libruby.so.3.4 and is tied to that Ruby's ABI, but platform gems are selected by OS/arch only - a Ruby 3.3 or 3.5 host on x86_64-linux would install this gem and get a confusing `require` failure. spec.required_ruby_version is now pinned to the building Ruby's X.Y line (e.g. "~> 3.4.0" when built under 3.4.13). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Confirmed by actually testing it, and it mattered: built a gem with a sentinel VERSION, installed it, ran the exact previous smoke-test rspec command, and it printed the repo's checked-out version/path, not the installed gem's. rspec-core adds a project-relative lib/ to the load path ahead of RubyGems' own resolution, so every prior smoke-test run was silently requiring the checked-out repo's .rb files instead of the installed gem's (the compiled bindings.so was unaffected, since it's gitignored from the checkout - this only affected the Ruby wrapper files). It happened to not matter, since repo and packaged .rb files are always identical at a given commit, but the "verified against the installed gem" claim wasn't actually true, and it would have silently masked a real spec.files packaging bug. Fix: `rm -rf lib` (the checked-out repo's own) right before running rspec, staying in the repo root so spec/pulsar/message_spec.rb's LICENSE fixture read still resolves. Verified this way: plain gem install + require now correctly resolves to the installed gem, no -I flag even needed anymore. Also: added patchelf to the build job (needed by the Rakefile's new RUNPATH fix) and a top-level `permissions: contents: read` (a future publish job should request its own packages: write rather than this workflow having broader-than-needed default token permissions). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Two real inaccuracies, both confirmed before fixing:
- "~> 2.6.1.pre" does not match this gem's actual normalized version.
Checked directly: Gem::Requirement.new("~> 2.6.1.pre").satisfied_by?
(Gem::Version.new("2.6.1-beta.2")) is false ("2.6.1-beta.2" normalizes to
"2.6.1.pre.beta.2"). "~> 2.6.1.pre.beta" does match. Fixed both the
general install example and the precompiled-gem example.
- The "falls back to the source gem" claim was wrong: Bundler's
`source "..." do gem ... end` block scopes resolution of that gem to
only that source (by design, to prevent dependency confusion attacks) -
there's no automatic fallback for an unsupported platform/arch/Ruby
version. Rewrote to describe the actual choice (pick the GitHub Packages
source or the plain gemspec-based entry per environment, not both at
once).
Also updated the section heading (still said "x86_64-linux" only, stale
since aarch64-linux landed) and noted publishing isn't wired up yet, so
this doesn't read as already-working.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
A finding I'd missed in the first pass of fixes: lib/pulsar/libpulsar.so and lib/pulsar/bindings.so were left in the working tree after gem:native:* ran, weren't gitignored (.gitignore only had bindings.bundle, the macOS suffix, confirmed empirically - .so was never covered), and a leftover vendored libpulsar.so would get silently picked up by a later plain `rake compile`'s $ORIGIN rpath, or get committed by accident. - Added lib/pulsar/*.so to .gitignore. - Added the vendored lib to CLOBBER (rake-compiler's own clean/clobber task doesn't know about it, unlike bindings.so, which it already handled correctly). - Wrapped the packaging steps in begin/ensure so both files are removed right after packaging (success or failure), not just on the next clean/clobber run. Verified: git status is clean immediately after gem:native:x86_64-linux with no manual cleanup; the built gem still contains both files (Gem::Package.build runs before the ensure fires) and still installs and loads correctly; a manually-placed leftover libpulsar.so is removed by `rake clobber` via the new CLOBBER entry; the normal from-source build is unaffected (84 examples, 0 failures, 3 pending). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
…ions RubyGems registries (GitHub Packages included) are immutable per version, so publishing a fresh gem on every master commit needs a genuinely new version each time. When PULSAR_GEM_BUILD_NUMBER is set, append it as a trailing segment to the gemspec's version (e.g. "2.6.1.pre.beta.2.47"). Unset (the normal local/manual case), nothing changes - verified both paths locally: unset still produces exactly "2.6.1.pre.beta.2" as before, and set to "47" produces "2.6.1.pre.beta.2.47" with required_ruby_version and dependencies both still applied correctly. Also re-ran the full install-into-clean-GEM_HOME-with-libpulsar-removed rehearsal against the build-numbered gem: require, construct a client, and the non-broker spec suite all pass (42 examples, 0 failures, 3 pending) exactly as with an unnumbered build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
…first Adds a push-to-master trigger (no paths: filter - every commit should get a fresh build, unlike pull_request's scoped trigger) and a new `publish` job that gem pushes both platform artifacts to GitHub Packages, with its own job-level `packages: write` (the workflow's default permissions stay read-only). The build job now sets PULSAR_GEM_BUILD_NUMBER unconditionally so the exact artifact that gets smoke-tested is what would be published, with no separate rebuild step. Rollout gate: `publish`'s `if:` currently requires workflow_dispatch, not the real push-to-master condition (commented out next to it) - so one real publish can be triggered and confirmed by hand (package actually lands in GitHub Packages, a clean environment can install it) before this runs unattended on every master commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Rewrites the precompiled-gem section to be something an internal dev can follow with no other context: one-time read:packages credential setup (personal PAT for dev machines vs. an org secret for CI/prod, since those are different credentials with different scopes), a floating Gemfile entry for local arm64 dev (bundle update picks up the newest build), a pinned Gemfile entry for amd64 production (bumped deliberately via a normal PR, not automatically), and a short note on why versions carry a trailing build-number segment. Also states plainly that nothing is actually published yet - the mechanism exists but hasn't done a real publish, so this section doesn't get ahead of what's true. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
The first real publish test failed for one platform: GitHub Packages rejected it with "Version ... has already been pushed", because both platform gems in the same CI run shared the identical version string (same github.run_number). Confirmed against the real registry: unlike rubygems.org, GitHub Packages' RubyGems registry keys version uniqueness on name+version alone, not name+version+platform - it doesn't model "platform gems sharing a version" the way the gem format itself does. Append a stable per-platform tag (NATIVE_GEM_PLATFORMS.keys.index) after the build number, so x86_64-linux and aarch64-linux never collide within a run (e.g. "2.6.1.pre.beta.2.9.0" vs "...2.9.1"). Doesn't change ordering across runs (the run number still dominates), and doesn't matter to consumers either way - Bundler/RubyGems filter to the local platform before applying a version constraint, so the two platforms' versions are never compared against each other. Updated the README's example version strings to match. Re-verified locally: required_ruby_version and dependencies still apply correctly alongside the new version, and the gem still installs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
A successful `gem push` doesn't by itself prove the package is fetchable - adds verify-publish, which installs straight from rubygems.pkg.github.com/get-bridge (not the local pkg/*.gem artifact) into a clean ubuntu:22.04 container per platform, then requires it and constructs a client. Same gate as publish (workflow_dispatch only for now). Needs its own packages: read permission, separate from publish's packages: write. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
…m install The first verify-publish run failed - but not because the publish was broken. It tried to build rice's native extension from source, which meant `gem install pulsar-client --pre --source X` resolved a completely different gem than the one we just published: "pulsar-client" is already a real, public gem on rubygems.org (the original upstream project, confirmed via rubygems.org's API - same base version, "ruby" platform, with a real rice dependency). `gem install --source X` isn't exclusive to X, it also consults the default source, so it's exactly as exposed to this name collision as a consumer doing the same thing would be. This is precisely what the README already tells consumers to avoid with Bundler's scoped `source "..." do ... end` block, so verify-publish should exercise that real mechanism, not a plain `gem install` that was never the recommended path. Switched to writing a throwaway Gemfile with the scoped source and running `bundle install` against it, with credentials via `bundle config set` instead of an embedded URL. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
…agnostic The scoped-source bundle install itself succeeded (confirmed: "Bundle complete! 1 Gemfile dependency, 2 gems now installed", resolving the correct GitHub Packages version) but a *separate* later step's `bundle exec` then failed with Bundler::GemNotFound. Merging into one step (no reason to keep them separate for a verification job) to rule out any cross-step state difference, and printing Gemfile.lock to see what Bundler actually recorded if this fails again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
…ssue verify-publish's Bundler-based install failed: Gemfile.lock recorded "pulsar-client (VERSION)" with no platform suffix, even though the real .gem file is tagged x86_64-linux - Bundler then can't match its lockfile entry against the installed gem (Bundler::GemNotFound). Before concluding this is a hard registry limitation, isolate exactly where the platform info goes missing: `gem list -r --all` (does the registry report platform-suffixed versions to a plain RubyGems client at all?), the raw compact-index `info/pulsar-client` response (what does the registry literally serve?), and a plain `gem install --platform x86_64-linux --clear-sources` (does an explicit, unambiguous, non-Bundler install work?). Temporary job, gated the same as publish/verify-publish. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
GitHub Packages' RubyGems registry doesn't preserve Gem::Platform metadata
at all - confirmed by testing: an explicit `gem install --platform
x86_64-linux` against it installed the aarch64 build instead, then failed
to load (wrong architecture's machine code). The distinct-version-per-run
fix from the previous commit stopped `gem push` from rejecting the second
platform, but never actually solved the real problem - a client still had
no way to tell which published version was which architecture.
Switch to separate gem names per architecture instead:
spec.name = "pulsar-client-#{platform}" (e.g. "pulsar-client-x86_64-linux").
Since each name now only ever holds one architecture, the registry never
needs to distinguish platforms within a name, which is exactly the thing
it can't do. Dropped the now-unneeded per-platform version-tag suffix
(same-name collision no longer exists) and left spec.platform at its
default ("ruby") rather than tagging it with the real architecture, since
the registry ignores it and keeping it set would be vestigial at best.
Verified locally: the built gem reports name "pulsar-client-x86_64-linux",
platform "ruby", required_ruby_version and dependencies unaffected; the
full install-into-clean-GEM_HOME-with-libpulsar-removed rehearsal (via an
isolated repo copy, not the real working tree) passes - require, construct
a client, and the full non-broker spec suite (42 examples, 0 failures, 3
pending) - confirming require "pulsar/client" resolves correctly
regardless of the installing gem's own package name.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
verify-publish's throwaway Gemfile now depends on
pulsar-client-${{ matrix.platform }} instead of the shared "pulsar-client"
name, matching the Rakefile's new per-architecture naming. Removed
diagnose-registry entirely - it was a temporary job to isolate the
GitHub Packages platform-metadata issue, and it answered that question
(confirmed: the registry doesn't preserve Gem::Platform at all).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Updates the precompiled-gem section for the pulsar-client-x86_64-linux / pulsar-client-aarch64-linux naming (GitHub Packages can't distinguish Gem::Platform within one name, confirmed by testing), and adds a single Gemfile source block that picks the right name via Gem::Platform.local.cpu so one setup works on both arm64 dev and amd64 production - switching between the floating dev line and the pinned production line is just commenting out the other. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
zsbutosi
left a comment
There was a problem hiding this comment.
Re-review at 187358e. Given that GitHub Packages drops Gem::Platform, one gem name per architecture is a reasonable workaround, and the build side looks good: require "pulsar/client" is unaffected, the smoke test doesn't depend on the gem name, and the build-numbered versions sort correctly (2.6.1.pre.beta.2.47 is a prerelease, sorts above …2.9 and satisfies >= 2.6.1.pre.beta).
Requesting changes on the consumer-facing README recipe. Inline comments R1–R4:
- R1 (blocking): the arch-dependent gem name breaks a
Gemfile.lockshared across architectures. - R2 (blocking): on macOS the CPU check picks the Linux
x86_64gem. - R3:
Bundler.requireno longer loads the gem. - R4: the
~/.gem/credentialsoption doesn't authenticatebundle install.
R1–R4 all touch the same README block, so one pass should cover them.
The smaller items we noted (verify-publish not pinning the exact build, run-number reuse on a full re-run, the from-source path resolving to the upstream gem, and token/wording nits) are accepted as they are. No changes needed for this PR.
…ption 4 real bugs in the previous Gemfile example, each confirmed by reading the actual Bundler/RubyGems source before fixing: - The ternary picked a different gem *name* per architecture, so a Gemfile.lock written on one architecture breaks `bundle install --frozen`/`--deployment` on another (confirmed: this is exactly what install_if exists to solve - declare every platform-specific gem up front so the lockfile is identical everywhere, install only the one whose predicate matches). - Gem::Platform.local.cpu is "arm64" on Apple Silicon macOS, not "aarch64" (confirmed by reading rubygems/platform.rb directly - no such aliasing exists), so both macOS architectures silently fell through to the Linux x86_64 gem and failed at require time instead of falling back to source compilation like the text claimed. - Without require: "pulsar/client", Bundler.require silently fails to load a gem whose package name doesn't match its require path (confirmed by reading bundler/runtime.rb's Runtime#require - it retries once with dashes turned into slashes, and swallows the LoadError with no further action when that also fails). - ~/.gem/credentials doesn't authenticate bundle install at all (confirmed: grepped Bundler's lib for any handling of it - there is none; it's a separate credential store the `gem` CLI itself reads for things like `gem push`). Replaced with the install_if pattern: one Gemfile, unchanged across every environment, a real non-Linux fallback to git-sourced compilation, and require: "pulsar/client" on every line. Also reframed "dev floats / production pins" around one shared Gemfile.lock (open constraint in the Gemfile everywhere; the committed lockfile is what's actually pinned, moved forward by a deliberate `bundle update` + PR) instead of two separate Gemfile variants, since R1 showed those can't coexist safely anyway. Dropped the non-working ~/.gem/credentials bullet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Previously hardcoded gem "pulsar-client-${{ matrix.platform }}" per matrix
leg - correct, but not actually testing the self-selecting logic the
README documents for consumers. Now both runners get byte-identical
Gemfile content (the real install_if pattern), so a pass genuinely proves
`bundle install` resolves the right architecture's gem on its own, not
that a pre-selected name happens to work. Also calls Bundler.require
(not just bundle install/exec) so the require: "pulsar/client" option is
actually exercised, and reports whichever pulsar-client-* gem ended up
installed/activated rather than asserting the name up front.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
The manual-only rollout gate did its job: confirmed end-to-end across several workflow_dispatch runs, including the real install_if-based consumer Gemfile correctly resolving pulsar-client-x86_64-linux / pulsar-client-aarch64-linux via a genuine bundle install + Bundler.require on matching runners. publish's `if:` now requires a push to master instead of workflow_dispatch, so every master commit publishes a fresh version for both architectures unattended, per the original ask for an always up-to-date gem. verify-publish is intentionally left gated to workflow_dispatch only for now - flipping it too would double the per-push publish-related CI cost (a second registry round-trip per push) for continuous confirmation rather than a feature; can flip that too if wanted. Updated the README's status line to match - this is live now, not a described-but-unconfirmed intent. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
zsbutosi
left a comment
There was a problem hiding this comment.
Re-review at 5cefa63: thanks, R1–R4 are all fixed and the replies match the diff. The git-URL fallback also takes care of the upstream-gem issue we had accepted.
One thing to fix before merge, inline below (V1): since 5cefa63, verify-publish can't run.
Real bug, confirmed against GitHub Actions' documented behavior: a job's custom `if:` is implicitly ANDed with success() on its needs unless the condition uses always()/etc. verify-publish needs: publish but had its own if: github.event_name == 'workflow_dispatch', while publish (since 5cefa63) requires push-to-master - mutually exclusive, so verify-publish could never run on either trigger: on a push, publish runs but verify-publish's own if is false; on workflow_dispatch, publish is skipped so verify-publish's needs check fails regardless of its own if. My "intentionally gated to workflow_dispatch" note on that commit was wrong - it was already broken, not just conservatively scoped. Fixed by matching verify-publish's condition to publish's, exactly as suggested. Can't re-verify the full publish+verify-publish chain from this branch - that path now only fires on a real push to master - but build and smoke-test (unaffected by this change) still need to pass on the pull_request-triggered run, and the actual end-to-end proof will come from the first real master push after this merges. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
smoke-test's ubuntu:22.04 leg failed twice in a row on apt-get update, unable to reach archive.ubuntu.com (connection timeouts) while security.ubuntu.com succeeded both times - a bare container's apt sources hit Canonical's public mirror directly, not the hosted runner's own accelerated mirror. Retry up to 5 times with linear backoff before giving up, in both smoke-test and verify-publish (the two jobs that run in a bare ubuntu: container). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AhddxtLMgUUeLqiyK6NZwn
Summary
Phase 1+2 of PLT-1393's "prebuilt binaries" goal: precompiled
x86_64-linuxandaarch64-linuxplatform gems, both needing no C++ toolchain or systemlibpulsarto install.ext/bindings/extconf.rb: added-Wl,-rpath,'$ORIGIN'so alibpulsar.sovendored next tobindings.sois found at runtime. Harmless for a normal from-source build.Rakefile:rake gem:native:x86_64-linux/rake gem:native:aarch64-linux. Each downloads Apache's matching release-archive.debs (deb-x86_64/deb-arm64), compilesbindings.soagainst them, vendors the extractedlibpulsar.sointolib/pulsar/, and packages aGem::Platform-tagged gem withextensionsanddependenciesboth cleared (nothing to build, andrice/rake-compilerare build-time only - not needed at runtime)..github/workflows/release-native-gem.yml(this repo's first CI of any kind): builds both platforms (ubuntu-22.04for x86_64, GitHub's nativeubuntu-22.04-armrunner for aarch64 - no QEMU emulation), then smoke-tests each in genuinely cleanubuntu:22.04/ubuntu:24.04containers on a matching-arch runner.workflow_dispatch+pull_request(scoped viapaths:toRakefile/ext/**/the gemspec/this workflow) - the latter kept permanently since it already caught 3 real bugs pre-merge.README.md: documented the precompiled-gem install path (GitHub Packages), dropped a stale "archived" banner.Why libpulsar.so alone is enough to vendor
libpulsar.sohas zero non-stdlib dynamic dependencies (confirmed vialdd: justlibc/libstdc++/libm/libpthread/libdl/libgcc_s). Apache already statically links boost/protobuf/jsoncpp/curl into the one file.Verification
All of the following is from real CI runs on this PR, not just local rehearsal (though the x86_64 mechanism was also fully rehearsed locally first, including installing into a
GEM_HOMEwith/usr/lib/libpulsar.so//usr/include/pulsarphysically removed from the system):gem install --local,require "pulsar/client", construct aPulsar::Client, run the full non-broker spec suite against the installed gem. All four: 42 examples, 0 failures, 3 pending. Confirmedaarch64-linuxruns are genuinely native (ruby ... [aarch64-linux]), not emulated.Three real bugs were caught and fixed this way, each only visible once an actual GitHub Actions container ran it (not from local reasoning alone):
bindings.soitself (only vendoredlibpulsar.so).ruby/setup-ruby's prebuilt Ruby needslibyaml-0.so.2(forpsych/YAML) at runtime - present on GitHub's full hosted runners by default, missing from a bareubuntu:container. Addedlibyaml-0-2; confirmed it's a universal Ruby dependency, unrelated to this gem.rice (~> 2.1)as a runtime dependency from the source gemspec - butrice(andrake-compiler) are build-time only.gem install --localcouldn't resolve it. Clearedspec.dependenciesfor the platform gem.Out of scope for this PR
get_smart/production).gem pushtrigger to GitHub Packages (needs your go-ahead for the first live publish).get_smartitself (pointing its Gemfile at the published gem is separate, once this exists).Generated by Claude Code