@@ -142,7 +142,20 @@ jobs:
142142 git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git"
143143 git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git"
144144
145+ # Build the main binary
145146 ${{ matrix.settings.build }}
147+
148+ # Build the WASI module for Linux targets
149+ if [[ "${{ matrix.settings.target }}" == "x86_64-unknown-linux-gnu" ]]; then
150+ echo "Building fix-python-soname WASI module..."
151+ rustup target add wasm32-wasip1
152+ cd fix-python-soname
153+ cargo build --target wasm32-wasip1 --release
154+ cd ..
155+ # Copy WASM to root
156+ cp target/wasm32-wasip1/release/fix-python-soname.wasm .
157+ ls -la fix-python-soname.wasm
158+ fi
146159 - name : Build
147160 run : ${{ matrix.settings.build }}
148161 if : ${{ !matrix.settings.docker }}
@@ -155,6 +168,8 @@ jobs:
155168 ${{ env.APP_NAME }}.*.node
156169 index.d.ts
157170 index.js
171+ fix-python-soname.wasm
172+ fix-python-soname.js
158173 if-no-files-found : error
159174
160175 test-macOS-windows-binding :
@@ -331,6 +346,13 @@ jobs:
331346 corepack disable
332347 npm i -gf pnpm
333348 pnpm install --prefer-offline
349+
350+ # Fix Python soname if WASI module is available
351+ if [ -f "fix-python-soname.wasm" ] && [ -f "fix-python-soname.js" ]; then
352+ echo "Fixing Python soname in .node file..."
353+ node fix-python-soname.js || echo "Warning: Failed to fix Python soname"
354+ fi
355+
334356 pnpm test
335357
336358 publish :
@@ -356,6 +378,27 @@ jobs:
356378 path : artifacts
357379 - name : Move artifacts
358380 run : pnpm artifacts
381+ - name : Copy fix-python-soname files to Linux packages
382+ run : |
383+ # Find the WASM and JS files from Linux artifacts
384+ WASM_FILE=$(find artifacts -name "fix-python-soname.wasm" | head -n 1)
385+ JS_FILE=$(find artifacts -name "fix-python-soname.js" | head -n 1)
386+
387+ if [ -n "$WASM_FILE" ] && [ -n "$JS_FILE" ]; then
388+ echo "Found WASM file: $WASM_FILE"
389+ echo "Found JS file: $JS_FILE"
390+
391+ # Copy to all Linux npm directories
392+ for dir in npm/*/; do
393+ if [[ "$dir" == *"linux"* ]]; then
394+ echo "Copying files to $dir"
395+ cp "$WASM_FILE" "$dir"
396+ cp "$JS_FILE" "$dir"
397+ fi
398+ done
399+ else
400+ echo "Warning: fix-python-soname files not found in artifacts"
401+ fi
359402 - name : List packages
360403 run : ls -R ./npm
361404 shell : bash
0 commit comments