From c8ffceb0d4be8727e848122d91d0c881fb4e331b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Cabrera?= Date: Wed, 14 Oct 2026 20:30:14 -0400 Subject: [PATCH] ci: pin the platforms and Ruby versions of 36.x Pin the platforms and Ruby versions that 36.0.0 was released for, and test against the same Ruby versions in CI. The data fetched from CI now includes `aarch64-mingw-ucrt`, which this branch's `rb_sys` doesn't support, and Ruby 4.0, which this branch's `magnus` doesn't build against additionally they no longer include Ruby 3.2, which 36.0.0 supports. This also fixes lint issues, which are reported from the latest Rust. --- .github/release-matrix.json | 12 ++++++++++++ .github/workflows/ci.yml | 16 +++++----------- ext/src/ruby_api/component/convert.rs | 2 +- ext/src/ruby_api/engine.rs | 2 +- ext/src/ruby_api/instance.rs | 5 +---- 5 files changed, 20 insertions(+), 17 deletions(-) create mode 100644 .github/release-matrix.json diff --git a/.github/release-matrix.json b/.github/release-matrix.json new file mode 100644 index 00000000..dc6744b1 --- /dev/null +++ b/.github/release-matrix.json @@ -0,0 +1,12 @@ +{ + "supported-ruby-platforms": [ + "aarch64-linux", + "aarch64-linux-musl", + "arm64-darwin", + "x64-mingw-ucrt", + "x86_64-darwin", + "x86_64-linux", + "x86_64-linux-musl" + ], + "stable-ruby-versions": ["3.2", "3.3", "3.4"] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35787c9b..a9693cca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,18 +13,12 @@ env: RSPEC_FORMATTER: doc jobs: + # Test the Ruby versions pinned in `.github/release-matrix.json`, resolved the + # same way as for releases. ci-data: - runs-on: ubuntu-latest - outputs: - result: ${{ steps.fetch.outputs.result }} - steps: - - id: fetch - uses: oxidize-rb/actions/fetch-ci-data@v1 - with: - stable-ruby-versions: | - # See https://github.com/bytecodealliance/wasmtime-rb/issues/286 - # for details. - exclude: [head] + uses: bytecodealliance/wasmtime-rb/.github/workflows/native-gem-matrix.yml@main + with: + snapshot: true ci: runs-on: ${{ matrix.os }} diff --git a/ext/src/ruby_api/component/convert.rs b/ext/src/ruby_api/component/convert.rs index 2b128bc6..f0bdf620 100644 --- a/ext/src/ruby_api/component/convert.rs +++ b/ext/src/ruby_api/component/convert.rs @@ -211,7 +211,7 @@ pub(crate) fn rb_to_component_val( let payload_val = match (&case.ty, payload_rb.is_nil()) { (Some(ty), _) => rb_to_component_val(payload_rb, _store, ty) .map(|val| Some(Box::new(val))) - .map_err(|e| e.append(format!(" (variant value for \"{}\")", &name))), + .map_err(|e| e.append(format!(" (variant value for \"{}\")", name))), // case doesn't have payload and Variant#value *is nil* (None, true) => Ok(None), diff --git a/ext/src/ruby_api/engine.rs b/ext/src/ruby_api/engine.rs index ec3b790c..1c023752 100644 --- a/ext/src/ruby_api/engine.rs +++ b/ext/src/ruby_api/engine.rs @@ -90,7 +90,7 @@ impl Engine { pub fn new(args: &[Value]) -> Result { let args = scan_args::scan_args::<(), (Option,), (), (), (), ()>(args)?; let (config,) = args.optional; - let config = config.and_then(|v| if v.is_nil() { None } else { Some(v) }); + let config = config.filter(|v| !v.is_nil()); let inner = match config { Some(config) => { let config = RHash::try_convert(config).and_then(hash_to_config)?; diff --git a/ext/src/ruby_api/instance.rs b/ext/src/ruby_api/instance.rs index 0a8acf90..313bfbcb 100644 --- a/ext/src/ruby_api/instance.rs +++ b/ext/src/ruby_api/instance.rs @@ -43,10 +43,7 @@ impl Instance { scan_args::scan_args::<(Obj, &Module), (Option,), (), (), (), ()>(args)?; let (wrapped_store, module) = args.required; let mut context = wrapped_store.context_mut(); - let imports = args - .optional - .0 - .and_then(|v| if v.is_nil() { None } else { Some(v) }); + let imports = args.optional.0.filter(|v| !v.is_nil()); let imports: Vec = match imports { Some(arr) => {