@@ -118,27 +118,63 @@ jobs:
118118 key : onnx-runtime-${{ steps.wasm-cache-keys.outputs.onnx-hash }}
119119 restore-keys : onnx-runtime-
120120
121+ - name : Verify Yoga Layout cache
122+ id : yoga-cache-valid
123+ shell : bash
124+ run : |
125+ if [ -f "packages/yoga-layout/build/wasm/yoga.wasm" ] && [ -f "packages/yoga-layout/build/wasm/yoga.js" ]; then
126+ echo "valid=true" >> $GITHUB_OUTPUT
127+ echo "✓ Yoga Layout cache valid"
128+ else
129+ echo "valid=false" >> $GITHUB_OUTPUT
130+ echo "✗ Yoga Layout cache invalid or missing"
131+ fi
132+
133+ - name : Verify AI models cache
134+ id : ai-cache-valid
135+ shell : bash
136+ run : |
137+ if [ -f "packages/socketbin-cli-ai/dist/ai.bz" ] && [ -f "packages/socketbin-cli-ai/dist/ai.js" ]; then
138+ echo "valid=true" >> $GITHUB_OUTPUT
139+ echo "✓ AI models cache valid"
140+ else
141+ echo "valid=false" >> $GITHUB_OUTPUT
142+ echo "✗ AI models cache invalid or missing"
143+ fi
144+
145+ - name : Verify ONNX Runtime cache
146+ id : onnx-cache-valid
147+ shell : bash
148+ run : |
149+ if [ -f "packages/onnx-runtime-builder/dist/onnxruntime-web.wasm" ]; then
150+ echo "valid=true" >> $GITHUB_OUTPUT
151+ echo "✓ ONNX Runtime cache valid"
152+ else
153+ echo "valid=false" >> $GITHUB_OUTPUT
154+ echo "✗ ONNX Runtime cache invalid or missing"
155+ fi
156+
121157 - name : Setup Python for WASM builds
122- if : steps.yoga-cache.outputs.cache-hit != 'true' || steps.ai-cache.outputs.cache-hit != 'true' || steps.onnx-cache.outputs.cache-hit != 'true'
158+ if : steps.yoga-cache-valid .outputs.valid != 'true' || steps.ai-cache-valid .outputs.valid != 'true' || steps.onnx-cache-valid .outputs.valid != 'true'
123159 uses : actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
124160 with :
125161 python-version : ' 3.11'
126162
127163 - name : Build WASM assets on cache miss
128- if : steps.yoga-cache.outputs.cache-hit != 'true' || steps.ai-cache.outputs.cache-hit != 'true' || steps.onnx-cache.outputs.cache-hit != 'true'
164+ if : steps.yoga-cache-valid .outputs.valid != 'true' || steps.ai-cache-valid .outputs.valid != 'true' || steps.onnx-cache-valid .outputs.valid != 'true'
129165 shell : bash
130166 run : |
131167 echo "⚠️ WASM cache miss detected - building from source"
132168 echo "This will take 30-60 minutes. Consider running build-wasm.yml workflow to prime cache."
133169 echo ""
134170 echo "Cache status:"
135- echo " Yoga Layout: ${{ steps.yoga-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
136- echo " AI Models: ${{ steps.ai-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
137- echo " ONNX Runtime: ${{ steps.onnx-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
171+ echo " Yoga Layout: ${{ steps.yoga-cache-valid .outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
172+ echo " AI Models: ${{ steps.ai-cache-valid .outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
173+ echo " ONNX Runtime: ${{ steps.onnx-cache-valid .outputs.valid == 'true' && '✓ cached' || '✗ missing' }}"
138174 echo ""
139175
140176 # Install Emscripten if needed for Yoga/ONNX.
141- if [ "${{ steps.yoga-cache.outputs.cache-hit }}" != "true" ] || [ "${{ steps.onnx-cache.outputs.cache-hit }}" != "true" ]; then
177+ if [ "${{ steps.yoga-cache-valid .outputs.valid }}" != "true" ] || [ "${{ steps.onnx-cache-valid .outputs.valid }}" != "true" ]; then
142178 echo "::group::Installing Emscripten"
143179 git clone https://github.com/emscripten-core/emsdk.git
144180 cd emsdk
@@ -160,27 +196,27 @@ jobs:
160196 fi
161197
162198 # Install Python deps if needed for AI models.
163- if [ "${{ steps.ai-cache.outputs.cache-hit }}" != "true" ]; then
199+ if [ "${{ steps.ai-cache-valid .outputs.valid }}" != "true" ]; then
164200 echo "::group::Installing Python dependencies"
165201 python3 -m pip install --upgrade pip
166202 python3 -m pip install transformers torch optimum[onnx] "onnxruntime>=1.20.0"
167203 echo "::endgroup::"
168204 fi
169205
170206 # Build missing WASM assets.
171- if [ "${{ steps.yoga-cache.outputs.cache-hit }}" != "true" ]; then
207+ if [ "${{ steps.yoga-cache-valid .outputs.valid }}" != "true" ]; then
172208 echo "::group::Building Yoga Layout WASM"
173209 pnpm --filter @socketsecurity/yoga-layout run build
174210 echo "::endgroup::"
175211 fi
176212
177- if [ "${{ steps.ai-cache.outputs.cache-hit }}" != "true" ]; then
213+ if [ "${{ steps.ai-cache-valid .outputs.valid }}" != "true" ]; then
178214 echo "::group::Building AI models (10-15 minutes)"
179215 pnpm --filter @socketbin/cli-ai run build
180216 echo "::endgroup::"
181217 fi
182218
183- if [ "${{ steps.onnx-cache.outputs.cache-hit }}" != "true" ]; then
219+ if [ "${{ steps.onnx-cache-valid .outputs.valid }}" != "true" ]; then
184220 echo "::group::Building ONNX Runtime (20-30 minutes)"
185221 pnpm --filter @socketsecurity/onnx-runtime-builder run build
186222 echo "::endgroup::"
@@ -204,7 +240,7 @@ jobs:
204240 restore-keys : node-sea-${{ matrix.platform }}-${{ matrix.arch }}-
205241
206242 - name : Check WASM cache requirements (Windows)
207- if : matrix.os == 'windows' && (steps.yoga-cache.outputs.cache-hit != 'true' || steps.ai-cache.outputs.cache-hit != 'true' || steps.onnx-cache.outputs.cache-hit != 'true')
243+ if : matrix.os == 'windows' && (steps.yoga-cache-valid .outputs.valid != 'true' || steps.ai-cache-valid .outputs.valid != 'true' || steps.onnx-cache-valid .outputs.valid != 'true')
208244 run : |
209245 echo "::error::WASM assets not cached for Windows build. Run build-wasm.yml workflow first to prime the cache."
210246 echo "Windows builds require pre-cached WASM assets due to network reliability issues."
0 commit comments