Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and publish ruby-wasm-wasi on CI #365

Merged
merged 1 commit into from
Jan 8, 2024
Merged
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
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
Loading