From a1475c03a5fb50b82a98c8442cc4b6f3656cd0d9 Mon Sep 17 00:00:00 2001 From: Ivan Panin Date: Sat, 9 Aug 2025 11:58:59 +0300 Subject: [PATCH] build: handle wasm without embedded base64 --- .github/workflows/build-wasm.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index 651132c..670fbc7 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -29,14 +29,18 @@ jobs: working-directory: app - name: Check SIMD flag run: | - node - <<'NODE' - const fs = require('fs'); - const m = fs.readFileSync('public/wasm/whisper-web.js', 'utf8') - .match(/data:application\/wasm;base64,([A-Za-z0-9+/=]+)/); - if (!m) process.exit(42); - fs.writeFileSync('/tmp/whisper.wasm', Buffer.from(m[1], 'base64')); - NODE - wasm-opt --detect-features /tmp/whisper.wasm | grep -q '+simd' + if [ -f public/wasm/whisper-web.wasm ]; then + wasm-opt --detect-features public/wasm/whisper-web.wasm | grep -q '+simd' + else + node - <<'NODE' + const fs = require('fs'); + const m = fs.readFileSync('public/wasm/whisper-web.js', 'utf8') + .match(/data:application\/wasm;base64,([A-Za-z0-9+/=]+)/); + if (!m) process.exit(42); + fs.writeFileSync('/tmp/whisper.wasm', Buffer.from(m[1], 'base64')); + NODE + wasm-opt --detect-features /tmp/whisper.wasm | grep -q '+simd' + fi - name: Post-build checks run: | test -f public/wasm/whisper-web.js