Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions .github/workflows/build-gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,33 @@ jobs:
with:
ruby-version: "3.4"

- uses: oxidize-rb/actions/cross-gem@v1
- name: Detect rb-sys version from Cargo.lock
id: rb-sys
run: |
version="$(awk '/name = "rb-sys"/{flag=1; next} flag && /version = / {gsub(/"/, "", $3); print $3; exit}' Cargo.lock)"
if [ -z "$version" ]; then
echo "Failed to detect rb-sys version from Cargo.lock" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"

- name: Build native gem with rb-sys-dock
id: cross-gem
with:
platform: ${{ matrix.ruby-platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}
env:
PLATFORM: ${{ matrix.ruby-platform }}
RUBY_VERSIONS: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}
RB_SYS_VERSION: ${{ steps.rb-sys.outputs.version }}
run: |
gem install rb_sys -v "$RB_SYS_VERSION"
rb-sys-dock --platform "$PLATFORM" --directory . --ruby-versions "$RUBY_VERSIONS" --tag "$RB_SYS_VERSION" --build

gem_path="$(find ./pkg -name "*-${PLATFORM}.gem" | head -n1)"
if [ -z "$gem_path" ]; then
echo "Failed to find built gem for ${PLATFORM}" >&2
ls -la ./pkg || true
exit 1
fi
echo "gem-path=$gem_path" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v7
with:
Expand Down
6 changes: 4 additions & 2 deletions rakelib/packaging.rake
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ def build_ruby(pkg, base_dir, pkg_dir, binaryen, clean: false)
Dir.chdir(cwd) do
# uninstall js gem to re-install just-built js gem
sh "gem", "uninstall", "js", "-v", js_gem_version, "--force"
# install gems including js gem
sh "bundle", "install"
# install gems including js gem. Bundler may compare checksums with
# rubygems.org for the same version and reject our just-built local gem.
# Disable checksum validation only for this install command.
sh({ "BUNDLE_DISABLE_CHECKSUM_VALIDATION" => "true" }, "bundle", "install")

sh env,
"bundle", "exec",
Expand Down
Loading