Skip to content

Commit 8099c57

Browse files
authored
test: build wasm modules in CI (#37)
1 parent 8c3503b commit 8099c57

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
with:
3535
python-version: "3.11"
3636

37+
- name: Setup emsdk
38+
uses: mymindstorm/setup-emsdk@v14
39+
with:
40+
version: 4.0.13
41+
3742
- name: Set up uv package manager
3843
uses: astral-sh/setup-uv@v5
3944

@@ -50,7 +55,10 @@ jobs:
5055
if: steps.cache-demo-data.outputs.cache-hit != 'true'
5156
run: cd packages/docs && uv run generate_demo_data.py
5257

53-
- name: Run custom build script
58+
- name: Build WASM modules
59+
run: ./scripts/build_wasm.sh
60+
61+
- name: Build JavaScript and Python packages
5462
run: ./scripts/build.sh
5563

5664
- name: Upload node package artifact

packages/density-clustering/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"module": "density_clustering_wasm/js/index.js",
88
"type": "module",
99
"scripts": {
10-
"build": "npx wasm-pack build --release --target web density_clustering_wasm && rm density_clustering_wasm/pkg/.gitignore density_clustering_wasm/pkg/package.json"
10+
"build": "npx -y wasm-pack build --release --target web density_clustering_wasm && rm density_clustering_wasm/pkg/.gitignore density_clustering_wasm/pkg/package.json"
1111
},
1212
"files": [
1313
"density_clustering_wasm/js/index.js",

packages/umap-wasm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ runtime.js: $(SOURCES) $(HEADERS)
2323
-DUMAPPP_NO_PARALLEL_OPTIMIZATION \
2424
-sENVIRONMENT=web \
2525
-sMODULARIZE -sSINGLE_FILE -sALLOW_MEMORY_GROWTH \
26+
-sEXPORTED_RUNTIME_METHODS='["HEAP32", "HEAPF32", "HEAPU8"]' \
2627
-sWASM_BIGINT=1 \
2728
-msimd128 \
2829
-o runtime.mjs

packages/umap-wasm/third_party/download_dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ download https://github.com/nmslib/hnswlib.git v0.8.0 hnswlib
6969
# BSD-2-Clause License
7070
download https://github.com/brj0/nndescent.git 514275f263be010712530a95e56ffc9b81b9110b nndescent
7171
pushd nndescent
72-
git apply ../nndescent.patch
72+
git apply ../nndescent.patch || true
7373
popd

scripts/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Build all JavaScript and Python packages
4+
35
set -euxo pipefail
46

57
pushd packages/component

scripts/build_wasm.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Build WASM modules
4+
5+
set -euxo pipefail
6+
7+
pushd packages/density-clustering
8+
npm run build
9+
popd
10+
11+
pushd packages/umap-wasm
12+
13+
pushd third_party
14+
./download_dependencies.sh
15+
popd
16+
17+
make
18+
19+
popd

0 commit comments

Comments
 (0)