From 1cb2e778f81353dba7a9976ae5dc65d04a2dfec7 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 23 Jan 2025 19:39:33 +0000 Subject: [PATCH 1/4] Use Ruby 3.4.1 in CI instead of master --- .github/workflows/build.yml | 8 ++++---- builders/wasm32-unknown-wasip2/Dockerfile | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0232f7a97..a569f4ab89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: fetch-depth: 0 - uses: ruby/setup-ruby@v1 with: - ruby-version: "head" + ruby-version: "3.4.1" bundler-cache: true - run: ./bin/setup - run: bundle exec rake check:type @@ -77,7 +77,7 @@ jobs: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: "head" + ruby-version: "3.4.1" bundler-cache: true - run: ./bin/setup - run: rake ci:pin_build_manifest @@ -150,7 +150,7 @@ jobs: - uses: ruby/setup-ruby@v1 if: ${{ matrix.entry.test != '' }} with: - ruby-version: "head" + ruby-version: "3.4.1" bundler-cache: false - name: rake ${{ matrix.entry.test }} run: | @@ -176,7 +176,7 @@ jobs: registry-url: https://registry.npmjs.org/ - uses: ruby/setup-ruby@v1 with: - ruby-version: "head" + ruby-version: "3.4.1" bundler-cache: true - run: ./bin/setup - run: echo "PREREL_NAME=${{ inputs.prerel_name }}" >> $GITHUB_ENV diff --git a/builders/wasm32-unknown-wasip2/Dockerfile b/builders/wasm32-unknown-wasip2/Dockerfile index ccd32fabed..147fbbc430 100644 --- a/builders/wasm32-unknown-wasip2/Dockerfile +++ b/builders/wasm32-unknown-wasip2/Dockerfile @@ -35,10 +35,12 @@ RUN set -eux pipefail; \ chmod -R a+w $RUSTUP_HOME $CARGO_HOME # Install the latest Ruby to use the latest Bundler for cross-building C extension gems. -ADD --keep-git-dir=true https://github.com/ruby/ruby.git /buildruby +ADD https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.1.tar.gz /buildruby.tar.gz RUN set -eux; \ + mkdir /buildruby; \ + tar -xf /buildruby.tar.gz -C /buildruby --strip-components=1; \ + rm /buildruby.tar.gz; \ cd /buildruby; \ - ./autogen.sh; \ mkdir -p /opt/ruby; \ ./configure --prefix=/opt/ruby --disable-install-doc; \ make -j$(nproc); \ From 0f1c86c8c9e9407bea1e07c5254628feea5c970e Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 23 Jan 2025 19:47:12 +0000 Subject: [PATCH 2/4] Workaround for rbs Ruby::UnannotatedEmptyCollection --- lib/ruby_wasm/build/product/crossruby.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/ruby_wasm/build/product/crossruby.rb b/lib/ruby_wasm/build/product/crossruby.rb index 8a2b536d23..736af0278c 100644 --- a/lib/ruby_wasm/build/product/crossruby.rb +++ b/lib/ruby_wasm/build/product/crossruby.rb @@ -94,11 +94,15 @@ def do_legacy_extconf(executor, crossruby) # HACK: extout is required to find config.h "-e", %Q($extout=ENV["extout"]="#{crossruby.build_dir}/.ext"), - *(@features.support_component_model? ? [] : [ + ] + unless @features.support_component_model? + extconf_args.concat([ # HACK: skip have_devel check since ruby is not installed yet "-e", "$have_devel = true", - ]), + ]) + end + extconf_args.concat([ # HACK: force static ext build by imitating extmk "-e", "$static = true; trace_var(:$static) {|v| $static = true }", @@ -115,7 +119,7 @@ def do_legacy_extconf(executor, crossruby) %Q(require "json"; File.write("#{metadata_json(crossruby)}", JSON.dump({target: $target}))), "-I#{crossruby.build_dir}", "--", - ] + ]) extconf_args << "--disable-component-model" unless @features.support_component_model? # Clear RUBYOPT to avoid loading unrelated bundle setup executor.system crossruby.baseruby_path, From 8a551a27e0434979933fd3315fc649390e2187e2 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 23 Jan 2025 19:55:37 +0000 Subject: [PATCH 3/4] Update cross-gem action to `oxidize-rb/actions` We had been using the deprecated `oxidize-rb/cross-gem-action` action so far as the new one somehow didn't work. But it seems to be working now and the old one is broken now. So let's switch to the new one. --- .github/workflows/build-gems.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-gems.yml b/.github/workflows/build-gems.yml index 14d8daef5f..e743e2c7a9 100644 --- a/.github/workflows/build-gems.yml +++ b/.github/workflows/build-gems.yml @@ -33,20 +33,18 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: oxidize-rb/actions/setup-ruby-and-rust@v1 + - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" - bundler-cache: true - cargo-cache: true - cargo-vendor: true - cache-version: v2-${{ matrix.ruby-platform }} + ruby-version: "3.4" - - name: Set vars - id: vars - run: | - echo "rb-sys-version=$(bundle exec ruby -rrb_sys -e 'puts RbSys::VERSION')" >> $GITHUB_OUTPUT - - uses: oxidize-rb/cross-gem-action@main + - uses: oxidize-rb/actions/cross-gem@v1 + id: cross-gem with: - version: ${{ steps.vars.outputs.rb-sys-version }} platform: ${{ matrix.ruby-platform }} - ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ', ') }} + ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }} + + - uses: actions/upload-artifact@v4 + with: + name: cross-gem-${{ matrix.ruby-platform }} + path: ${{ steps.cross-gem.outputs.gem-path }} + if-no-files-found: error From ca5547f22d50986a1052fd55dd00cb3da437d6bc Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Thu, 23 Jan 2025 20:29:10 +0000 Subject: [PATCH 4/4] Update rb-sys to the latest To include https://github.com/oxidize-rb/rb-sys/commit/df0e6f4d7bb59b52af68354238f35a9c25a2bc0e --- Cargo.lock | 8 ++++---- Gemfile | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6d3b12060..7afd429c2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1269,18 +1269,18 @@ dependencies = [ [[package]] name = "rb-sys" -version = "0.9.97" +version = "0.9.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d30bcad206b51f2f66121190ca678dce1fdf3a2eae0ac5d838d1818b19bdf5" +checksum = "1e955384e1a4dc64b71d1e4b39ed0edbd77c7bde4a10dfd5ad208e1160fddfa7" dependencies = [ "rb-sys-build", ] [[package]] name = "rb-sys-build" -version = "0.9.97" +version = "0.9.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbd92f281615f3c2dcb9dcb0f0576624752afbf9a7f99173b37c4b55b62dd8a" +checksum = "c167c6571889b2550d6fcb315e8aa60bdb95e47e4b64793e3f65a30dc25afc85" dependencies = [ "bindgen", "lazy_static", diff --git a/Gemfile b/Gemfile index 31c7e38524..adfecca751 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gemspec group :development do gem "rake" gem "rake-compiler" - gem "rb_sys", "0.9.97" + gem "rb_sys", "0.9.108" end group :check do