Skip to content

Commit

Permalink
Use oxidize-rb/actions/cross-gem@v1 instead of oxidize-rb/cross-gem-a…
Browse files Browse the repository at this point in the history
…ction@main

https://github.com/oxidize-rb/cross-gem-action has been archived in
favor of https://github.com/oxidize-rb/actions/tree/main/cross-gem.

This commit also:

1. Drops `x64-mingw32` from a precompiled build. As
https://github.com/rake-compiler/rake-compiler-dock says:

> x64-mingw-ucrt should be used for Ruby 3.1 and later on
  windows. x64-mingw32 should be used for Ruby 3.0 and earlier. This
  is to match the changed platform of RubyInstaller-3.1.

2. Use `RakeCompilerDock.ruby_cc_version` to set `RUBY_CC_VERSION`
so we don't have to worry about which patch versions can build.

3. Update rb-sys to v0.9.110 to fix build issues with GNU and musl
builds. While we're at it, update all Cargo dependencies.
  • Loading branch information
stanhu committed Feb 1, 2025
1 parent 8bb7577 commit 8ebcf17
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 46 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- "x86_64-darwin"
- "x86_64-linux-gnu"
- "x86_64-linux-musl"
- "x64-mingw32"
- "x64-mingw-ucrt"
environment: "yrb-deploy"
steps:
Expand All @@ -35,23 +34,19 @@ jobs:
cargo-cache: true
cargo-vendor: true

- name: Transform platform name
id: transform_platform
run: echo "cross_gem_platform=$(echo '${{ matrix.platform }}' | sed 's/-gnu$//')" >> $GITHUB_ENV

- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ env.cross_gem_action_platform }}
platform: ${{ matrix.platform }}
ruby-versions: '3.1,3.2,3.3,3.4'

- name: Display structure of built gems
run: ls -R
working-directory: ${{ steps.cross-gem.outputs.gem-path }}
working-directory: pkg/

- name: Release gem
if: startsWith(github.ref, 'refs/tags/v')
working-directory: ${{ steps.cross-gem.outputs.gem-path }}
working-directory: pkg/
env:
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.2.0
ruby-3.4.1
66 changes: 38 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 4 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

require "bundler/gem_tasks"
require "rubygems/package_task"
require "rake_compiler_dock"
require "rake/testtask"
require "rake/extensiontask"
require "rb_sys"

cross_rubies = %w[3.4.0 3.3.5 3.2.0 3.1.0]
ruby_cc_version = RakeCompilerDock.ruby_cc_version([">= 3.1", "< 3.5"])
cross_platforms = %w[
aarch64-linux-gnu
aarch64-linux-musl
Expand Down Expand Up @@ -41,15 +42,11 @@ namespace "gem" do
cross_platforms.each do |plat|
desc "Build the native gem for #{plat}"
task plat => "prepare" do
require "rake_compiler_dock"

# rbsys doesn't ship an alias -gnu image yet
rcd_plat = plat.gsub(/-gnu$/, '')
ENV["RCD_IMAGE"] = "rbsys/#{rcd_plat}:#{RbSys::VERSION}"
ENV["RCD_IMAGE"] = "rbsys/#{plat}:#{RbSys::VERSION}"

RakeCompilerDock.sh <<~SH, platform: plat
bundle && \
RUBY_CC_VERSION="#{cross_rubies.join(":")}" \
RUBY_CC_VERSION="#{ruby_cc_version}"
rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem
SH
end
Expand Down
3 changes: 1 addition & 2 deletions y-rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ Gem::Specification.new do |spec|
spec.metadata["rubygems_mfa_required"] = "true"

spec.add_dependency "rake", "~> 13.2"
spec.add_dependency "rb_sys", "~> 0.9.86"
spec.add_dependency "rb_sys", "~> 0.9.110"

spec.add_development_dependency "base64"
spec.add_development_dependency "rake-compiler", "~> 1.2.1"
spec.add_development_dependency "rake-compiler-dock", "~> 1.9.1"

spec.extensions = ["ext/yrb/extconf.rb"]
end

0 comments on commit 8ebcf17

Please sign in to comment.