Skip to content

Commit c87d8fc

Browse files
committed
fix(ci): make WASM optional in SEA builds with graceful fallback
Apply progressive enhancement pattern to build-sea workflow to match runtime graceful fallback behavior. The CLI runtime already handles missing WASM gracefully via onnx-runtime-stub.mts and falls back to baseline features (compromise library). The build workflow should do the same instead of hard-failing. Changes: - Convert Windows WASM cache check from error to warning - Skip WASM compilation on Windows (use baseline features only) - Make Python/Emscripten setup non-Windows only - Convert WASM verification from hard-fail to warning - Document progressive enhancement tiers in build output Progressive enhancement tiers: Tier 1 (Baseline): Pure JS with compromise - always available Tier 2 (Enhanced): MiniLM + ONNX Runtime - requires WASM Tier 3 (Full): CodeT5 - requires WASM + models Benefits: - Windows builds no longer blocked by missing WASM cache - Faster builds when WASM not needed - Consistent with runtime fallback behavior - CLI works on all platforms with baseline features
1 parent aa486be commit c87d8fc

1 file changed

Lines changed: 28 additions & 16 deletions

File tree

.github/workflows/build-sea.yml

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -318,21 +318,27 @@ jobs:
318318
# echo "✗ ONNX Runtime cache invalid or missing"
319319
# fi
320320

321-
- name: Check WASM cache requirements (Windows)
321+
- name: Check WASM cache status (Windows)
322322
if: steps.check-platform.outputs.should-run == 'true' && matrix.os == 'windows' && steps.yoga-cache-valid.outputs.valid != 'true'
323323
run: |
324-
echo "::error::WASM assets not cached for Windows build. Run build-wasm.yml workflow first to prime the cache."
325-
echo "Windows builds require pre-cached WASM assets due to network reliability issues."
326-
exit 1
324+
echo "::warning::WASM assets not cached. Build will use baseline features only."
325+
echo "For enhanced NLP features, run build-wasm.yml workflow first to prime the cache."
326+
echo ""
327+
echo "Progressive enhancement tiers:"
328+
echo " ✓ Tier 1 (Baseline): Pure JS with compromise - always available"
329+
echo " ✗ Tier 2 (Enhanced): MiniLM + ONNX Runtime - requires WASM"
330+
echo " ✗ Tier 3 (Full): CodeT5 - requires WASM + models"
331+
echo ""
332+
echo "The CLI will work normally with baseline features."
327333
328-
- name: Setup Python for WASM builds
329-
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true'
334+
- name: Setup Python for WASM builds (non-Windows)
335+
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true' && matrix.os != 'windows'
330336
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
331337
with:
332338
python-version: '3.11'
333339

334-
- name: Cache Emscripten SDK
335-
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true'
340+
- name: Cache Emscripten SDK (non-Windows)
341+
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true' && matrix.os != 'windows'
336342
id: emsdk-cache
337343
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
338344
with:
@@ -350,17 +356,17 @@ jobs:
350356
# pip-${{ runner.os }}-py3.11-
351357
# pip-${{ runner.os }}-
352358

353-
- name: Build WASM assets on cache miss
354-
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true'
359+
- name: Build WASM assets on cache miss (non-Windows)
360+
if: steps.check-platform.outputs.should-run == 'true' && steps.yoga-cache-valid.outputs.valid != 'true' && matrix.os != 'windows'
355361
shell: bash
356362
run: |
357363
echo "⚠️ WASM cache miss detected - building from source"
358364
echo "This will take 30-60 minutes. Consider running build-wasm.yml workflow to prime cache."
359365
echo ""
360366
echo "Cache status:"
361367
echo " Yoga Layout: ${{ steps.yoga-cache-valid.outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
362-
# echo " AI Models: ${{ steps.ai-cache-valid.outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
363-
# echo " ONNX Runtime: ${{ steps.onnx-cache-valid.outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
368+
echo ""
369+
echo "Note: Windows builds skip WASM compilation and use baseline features only."
364370
echo ""
365371
366372
# Install Emscripten if needed for Yoga.
@@ -469,11 +475,17 @@ jobs:
469475
# ls -lh packages/onnxruntime/dist/ 2>/dev/null || echo " ❌ Directory not found"
470476
echo ""
471477
472-
# Fail fast if critical Yoga Layout WASM is missing
478+
# Check if Yoga Layout WASM is available (optional with graceful fallback)
473479
if [ ! -f "packages/yoga-layout/build/wasm/yoga.wasm" ]; then
474-
echo "::error::Yoga Layout WASM not found! Run build-wasm.yml workflow to prime cache."
475-
echo "Cache status was: yoga=${{ steps.yoga-cache-valid.outputs.valid }}"
476-
exit 1
480+
echo "::warning::Yoga Layout WASM not found. Build will proceed with baseline features."
481+
echo "For enhanced NLP features, run build-wasm.yml workflow to prime cache."
482+
echo ""
483+
echo "Progressive enhancement:"
484+
echo " ✓ Tier 1 (Baseline): Pure JS - CLI will work normally"
485+
echo " ✗ Tier 2 (Enhanced): MiniLM + ONNX Runtime - requires WASM"
486+
echo " ✗ Tier 3 (Full): CodeT5 - requires WASM + models"
487+
else
488+
echo "✓ Yoga Layout WASM available - enhanced features enabled"
477489
fi
478490
479491
- name: Build CLI (required for SEA)

0 commit comments

Comments
 (0)