Skip to content

Commit 5967006

Browse files
committed
ci(wasm): add fail-fast checks before long builds
Add workflow status checks before starting long-running builds (models: 60min, onnx: 90min) to exit early if workflow already failed/cancelled. Prevents jobs from running expensive builds when another job has already failed, addressing queue hang issues when builds fail early.
1 parent 6a4101a commit 5967006

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/build-wasm.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,18 @@ jobs:
275275
ls -lh packages/models/dist/ 2>/dev/null || echo "Directory does not exist"
276276
fi
277277
278+
- name: Check workflow status before build
279+
if: steps.models-cache-valid.outputs.valid != 'true' || inputs.force
280+
run: |
281+
# Fail fast: check if workflow already failed before starting long build.
282+
STATUS=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }} --jq '.status' 2>/dev/null || echo "in_progress")
283+
if [ "$STATUS" = "cancelled" ]; then
284+
echo "Workflow was cancelled - exiting early"
285+
exit 1
286+
fi
287+
env:
288+
GH_TOKEN: ${{ github.token }}
289+
278290
- name: Build AI models
279291
if: steps.models-cache-valid.outputs.valid != 'true' || inputs.force
280292
run: |
@@ -420,6 +432,18 @@ jobs:
420432
cd emsdk
421433
./emsdk activate latest
422434
435+
- name: Check workflow status before build
436+
if: steps.onnx-cache-valid.outputs.valid != 'true' || inputs.force
437+
run: |
438+
# Fail fast: check if workflow already failed before starting long build.
439+
STATUS=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }} --jq '.status' 2>/dev/null || echo "in_progress")
440+
if [ "$STATUS" = "cancelled" ]; then
441+
echo "Workflow was cancelled - exiting early"
442+
exit 1
443+
fi
444+
env:
445+
GH_TOKEN: ${{ github.token }}
446+
423447
- name: Build ONNX Runtime WASM
424448
if: steps.onnx-cache-valid.outputs.valid != 'true' || inputs.force
425449
run: |

0 commit comments

Comments
 (0)