Skip to content

Commit 43e987d

Browse files
Test npm package on ci
1 parent ee5b5f8 commit 43e987d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ jobs:
107107
artifact_name: "npm-ruby-head-wasm-emscripten"
108108
builder: "wasm32-unknown-emscripten"
109109
- task: "npm:ruby-head-wasm-wasi"
110+
test: "npm:ruby-head-wasm-wasi-check"
110111
prerelease: "npm:configure_prerelease"
111112
artifact: "packages/npm-packages/ruby-head-wasm-wasi/ruby-head-wasm-wasi-*.tgz"
112113
artifact_name: "npm-ruby-head-wasm-wasi"
@@ -139,6 +140,9 @@ jobs:
139140
if: ${{ inputs.prerel_name != '' && matrix.entry.prerelease != '' }}
140141
- name: rake ${{ matrix.entry.task }}
141142
run: docker run -v "$GITHUB_WORKSPACE:/build" -w /build -e "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" sha256:$BUILDER_IMAGE_ID rake ${{ matrix.entry.task }}
143+
- name: rake ${{ matrix.entry.test }}
144+
run: rake ${{ matrix.entry.test }}
145+
if: ${{ matrix.entry.test != '' }}
142146
- uses: actions/upload-artifact@v2
143147
if: ${{ matrix.entry.artifact }}
144148
with:

Rakefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,20 @@ end
280280

281281
namespace :npm do
282282
NPM_PACKAGES.each do |pkg|
283+
base_dir = Dir.pwd
284+
pkg_dir = "#{Dir.pwd}/packages/npm-packages/#{pkg[:name]}"
285+
283286
desc "Build npm package #{pkg[:name]}"
284287
task pkg[:name] => ["build:#{pkg[:build]}"] do
285-
base_dir = Dir.pwd
286-
pkg_dir = "#{Dir.pwd}/packages/npm-packages/#{pkg[:name]}"
287288
sh "npm ci", chdir: pkg_dir
288289
sh "#{pkg_dir}/build-package.sh #{base_dir}/rubies/#{pkg[:build]}"
289290
sh "npm pack", chdir: pkg_dir
290291
end
292+
293+
desc "Check npm package #{pkg[:name]}"
294+
task "#{pkg[:name]}-check" do
295+
sh "npm test", chdir: pkg_dir
296+
end
291297
end
292298

293299
desc "Configure for pre-release"

packages/npm-packages/ruby-head-wasm-wasi/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"dist",
1111
"README.md"
1212
],
13+
"scripts": {
14+
"test": "cd ../ruby-wasm-wasi && npm test"
15+
},
1316
"repository": "https://github.com/ruby/ruby.wasm",
1417
"homepage": "https://github.com/ruby/ruby.wasm/tree/main/packages/npm-packages/ruby-head-wasm-wasi",
1518
"publishConfig": {

0 commit comments

Comments
 (0)