@@ -29,7 +29,42 @@ 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+ rustup target add wasm32-wasip1
55+ cd fix-python-soname
56+ cargo build --target wasm32-wasip1 --release
57+ cp target/wasm32-wasip1/release/fix-python-soname.wasm ..
58+ - name : Upload WASM artifacts
59+ uses : actions/upload-artifact@v4
60+ with :
61+ name : wasm-bindings
62+ path : |
63+ fix-python-soname.wasm
64+ fix-python-soname.js
65+
3266 build :
67+ needs : build-wasm
3368 strategy :
3469 fail-fast : false
3570 matrix :
5792 runs-on : ${{ matrix.settings.host }}
5893 steps :
5994 - uses : actions/checkout@v4
95+ - name : Download WASM artifacts
96+ uses : actions/download-artifact@v4
97+ with :
98+ name : wasm-bindings
99+ path : .
60100 - uses : webfactory/ssh-agent@v0.9.0
61101 with :
62102 ssh-private-key : |
@@ -149,7 +189,6 @@ jobs:
149189 git config --global url."ssh://git@github.com-http-handler/platformatic/http-handler.git".insteadOf "ssh://git@github.com/platformatic/http-handler.git"
150190 git config --global url."ssh://git@github.com-http-rewriter/platformatic/http-rewriter.git".insteadOf "ssh://git@github.com/platformatic/http-rewriter.git"
151191
152- npm run build:wasm
153192 ${{ matrix.settings.build }}
154193 - name : Build
155194 run : ${{ matrix.settings.build }}
@@ -431,7 +470,7 @@ jobs:
431470 exit 1
432471 fi
433472 shell : bash
434- - name : Copy fix-python-soname files to Linux packages
473+ - name : Copy fix-python-soname files to Linux and macOS packages
435474 run : |
436475 # Find the WASM and JS files from Linux artifacts
437476 WASM_FILE=$(find artifacts -name "fix-python-soname.wasm" | head -n 1)
@@ -441,9 +480,9 @@ jobs:
441480 echo "Found WASM file: $WASM_FILE"
442481 echo "Found JS file: $JS_FILE"
443482
444- # Copy to all Linux npm directories
483+ # Copy to all Linux and macOS npm directories
445484 for dir in npm/*/; do
446- if [[ "$dir" == *"linux"* ]]; then
485+ if [[ "$dir" == *"linux"* ]] || [[ "$dir" == *"darwin"* ]] ; then
447486 echo "Copying files to $dir"
448487 cp "$WASM_FILE" "$dir"
449488 cp "$JS_FILE" "$dir"
0 commit comments