@@ -29,7 +29,45 @@ concurrency:
2929 cancel-in-progress : true
3030
3131jobs :
32+ build-wasm :
33+ runs-on : ubuntu-latest
34+ steps :
35+ - uses : actions/checkout@v4
36+ with :
37+ fetch-depth : 0
38+ - name : Install Rust toolchain
39+ uses : dtolnay/rust-toolchain@stable
40+ with :
41+ targets : wasm32-wasip1
42+ - name : Cache cargo
43+ uses : actions/cache@v4
44+ with :
45+ path : |
46+ ~/.cargo/registry/index/
47+ ~/.cargo/registry/cache/
48+ ~/.cargo/git/db/
49+ .cargo-cache
50+ target/
51+ key : wasm-cargo-cache-${{ hashFiles('**/Cargo.lock') }}
52+ - name : Build WASM
53+ run : |
54+ # Temporarily move the workspace Cargo.toml to avoid workspace resolution
55+ mv Cargo.toml Cargo.toml.bak
56+ cd fix-python-soname
57+ cargo build --target wasm32-wasip1 --release
58+ cp target/wasm32-wasip1/release/fix-python-soname.wasm ..
59+ cd ..
60+ mv Cargo.toml.bak Cargo.toml
61+ - name : Upload WASM artifacts
62+ uses : actions/upload-artifact@v4
63+ with :
64+ name : wasm-bindings
65+ path : |
66+ fix-python-soname.wasm
67+ fix-python-soname.js
68+
3269 build :
70+ needs : build-wasm
3371 strategy :
3472 fail-fast : false
3573 matrix :
5795 runs-on : ${{ matrix.settings.host }}
5896 steps :
5997 - uses : actions/checkout@v4
98+ - name : Download WASM artifacts
99+ uses : actions/download-artifact@v4
100+ with :
101+ name : wasm-bindings
102+ path : .
60103 - uses : webfactory/ssh-agent@v0.9.0
61104 with :
62105 ssh-private-key : |
@@ -149,7 +192,6 @@ jobs:
149192 git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git"
150193 git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git"
151194
152- npm run build:wasm
153195 ${{ matrix.settings.build }}
154196 - name : Build
155197 run : ${{ matrix.settings.build }}
@@ -431,7 +473,7 @@ jobs:
431473 exit 1
432474 fi
433475 shell : bash
434- - name : Copy fix-python-soname files to Linux packages
476+ - name : Copy fix-python-soname files to Linux and macOS packages
435477 run : |
436478 # Find the WASM and JS files from Linux artifacts
437479 WASM_FILE=$(find artifacts -name "fix-python-soname.wasm" | head -n 1)
@@ -441,9 +483,9 @@ jobs:
441483 echo "Found WASM file: $WASM_FILE"
442484 echo "Found JS file: $JS_FILE"
443485
444- # Copy to all Linux npm directories
486+ # Copy to all Linux and macOS npm directories
445487 for dir in npm/*/; do
446- if [[ "$dir" == *"linux"* ]]; then
488+ if [[ "$dir" == *"linux"* ]] || [[ "$dir" == *"darwin"* ]] ; then
447489 echo "Copying files to $dir"
448490 cp "$WASM_FILE" "$dir"
449491 cp "$JS_FILE" "$dir"
0 commit comments