Skip to content

Commit

Permalink
Build and publish ruby-wasm-wasi on CI
Browse files Browse the repository at this point in the history
The CI job was accidentally removed while I was working on the RubyGems
support.
  • Loading branch information
kateinoigakukun committed Jan 8, 2024
1 parent 9770bbe commit b87a8c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ NPM_PACKAGES = [
ruby_version: "3.2",
gemfile: "packages/npm-packages/ruby-wasm-wasi/Gemfile",
target: "wasm32-unknown-wasi"
},
{
name: "ruby-wasm-wasi",
target: "wasm32-unknown-wasi"
}
]

Expand Down
8 changes: 7 additions & 1 deletion rakelib/packaging.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ tools = {
}

def npm_pkg_build_command(pkg)
# Skip if the package does not require building ruby
return nil unless pkg[:ruby_version] && pkg[:target]
[
"bundle",
"exec",
Expand All @@ -22,6 +24,7 @@ end

def npm_pkg_rubies_cache_key(pkg)
build_command = npm_pkg_build_command(pkg)
return nil unless build_command
require "open3"
cmd = build_command + ["--print-ruby-cache-key"]
stdout, status = Open3.capture2(*cmd)
Expand All @@ -38,10 +41,13 @@ namespace :npm do
pkg_dir = "#{Dir.pwd}/packages/npm-packages/#{pkg[:name]}"

namespace pkg[:name] do
build_command = npm_pkg_build_command(pkg)

desc "Build ruby for npm package #{pkg[:name]}"
task "ruby" do
build_command = npm_pkg_build_command(pkg)
# Skip if the package does not require building ruby
next unless build_command

env = {
# Share ./build and ./rubies in the same workspace
"RUBY_WASM_ROOT" => base_dir
Expand Down

0 comments on commit b87a8c0

Please sign in to comment.