2626 required : false
2727 type : boolean
2828 default : false
29- force-wasm-rebuild :
30- description : ' Force WASM rebuild (ignore cache)'
31- required : false
32- type : boolean
33- default : false
3429 node-versions :
3530 description : ' Node.js versions to test (JSON array)'
3631 required : false
@@ -41,27 +36,17 @@ permissions:
4136 contents : read
4237
4338jobs :
44- build-wasm :
45- name : Build WASM Assets
46- uses : ./.github/workflows/build-wasm.yml
47- with :
48- force : ${{ inputs.force-wasm-rebuild || false }}
49-
5039 ci :
5140 name : Run CI Pipeline
52- needs : build-wasm
5341 uses : SocketDev/socket-registry/.github/workflows/ci.yml@e7f70a7eb857a85b4f30677f9fc2c38bc9c4d56e # 2025-10-28
5442 with :
55- setup-script : ' mkdir -p packages/yoga-layout/build/wasm packages/socketbin-cli-ai/dist packages/onnx-runtime-builder/dist'
56- test-setup-script : ' echo "=== Build Setup Debug ===" && pwd && echo "Before build:" && (ls -la packages/cli/ 2>/dev/null || dir packages\\cli\\ || true) && pnpm --filter @socketsecurity/cli run build && echo "After build:" && (ls -la packages/cli/dist/ 2>/dev/null || dir packages\\cli\\dist\\ || true) && echo "Checking cli.js:" && (ls -la packages/cli/dist/cli.js 2>/dev/null || dir packages\\cli\\dist\\cli.js || true) && echo "=== Build Setup Complete ==="'
43+ test-setup-script : ' pnpm --filter @socketsecurity/cli run build'
5744 lint-script : ' pnpm --filter @socketsecurity/cli run check'
5845 type-check-script : ' pnpm --filter @socketsecurity/cli run type'
5946 test-script : ${{ inputs.skip-tests && 'echo "Tests skipped"' || 'pnpm --filter @socketsecurity/cli run test:unit' }}
6047 node-versions : ${{ inputs.node-versions || '[20, 22, 24]' }}
6148 os-versions : ' ["ubuntu-latest", "macos-latest", "windows-latest"]'
6249 fail-fast : false
63- artifacts-to-download : ' yoga-wasm,ai-models,onnx-runtime'
64- artifacts-path : ' .'
6550
6651 e2e :
6752 name : E2E Tests
@@ -78,120 +63,12 @@ jobs:
7863 with :
7964 node-version : ${{ matrix.node-version }}
8065
81- - name : Generate WASM cache keys
82- id : wasm-cache-keys
83- shell : bash
84- run : |
85- YOGA_HASH=$(find packages/yoga-layout -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.mjs" -o -name "CMakeLists.txt" \) | sort | xargs shasum -a 256 | shasum -a 256 | cut -d' ' -f1)
86- echo "yoga-hash=$YOGA_HASH" >> $GITHUB_OUTPUT
87-
88- AI_HASH=$(find packages/socketbin-cli-ai -type f \( -name "*.mjs" -o -name "*.ts" \) | sort | xargs shasum -a 256 | shasum -a 256 | cut -d' ' -f1)
89- echo "ai-hash=$AI_HASH" >> $GITHUB_OUTPUT
90-
91- ONNX_HASH=$(find packages/onnx-runtime-builder -type f \( -name "*.mjs" -o -name "*.patch" \) | sort | xargs shasum -a 256 | shasum -a 256 | cut -d' ' -f1)
92- echo "onnx-hash=$ONNX_HASH" >> $GITHUB_OUTPUT
93-
94- - name : Restore Yoga Layout WASM cache
95- id : yoga-cache
96- uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
97- with :
98- path : packages/yoga-layout/build/wasm
99- key : yoga-wasm-${{ steps.wasm-cache-keys.outputs.yoga-hash }}
100- restore-keys : yoga-wasm-
101-
102- - name : Restore AI models cache
103- id : ai-cache
104- uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
105- with :
106- path : packages/socketbin-cli-ai/dist
107- key : ai-models-${{ steps.wasm-cache-keys.outputs.ai-hash }}
108- restore-keys : ai-models-
109-
110- - name : Restore ONNX Runtime cache
111- id : onnx-cache
112- uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
113- with :
114- path : packages/onnx-runtime-builder/dist
115- key : onnx-runtime-${{ steps.wasm-cache-keys.outputs.onnx-hash }}
116- restore-keys : onnx-runtime-
117-
118- - name : Build WASM assets on cache miss
119- if : steps.yoga-cache.outputs.cache-hit != 'true' || steps.ai-cache.outputs.cache-hit != 'true' || steps.onnx-cache.outputs.cache-hit != 'true'
120- run : |
121- echo "⚠️ WASM cache miss detected - building from source"
122- echo "This will take 30-60 minutes. Consider running build-wasm.yml workflow to prime cache."
123- echo ""
124- echo "Cache status:"
125- echo " Yoga Layout: ${{ steps.yoga-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
126- echo " AI Models: ${{ steps.ai-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
127- echo " ONNX Runtime: ${{ steps.onnx-cache.outputs.cache-hit == 'true' && '✓ cached' || '✗ missing' }}"
128- echo ""
129-
130- # Install Emscripten if needed for Yoga/ONNX
131- if [ "${{ steps.yoga-cache.outputs.cache-hit }}" != "true" ] || [ "${{ steps.onnx-cache.outputs.cache-hit }}" != "true" ]; then
132- echo "Installing Emscripten..."
133- git clone https://github.com/emscripten-core/emsdk.git
134- cd emsdk
135- ./emsdk install latest
136- ./emsdk activate latest
137- source ./emsdk_env.sh
138- cd ..
139- fi
140-
141- # Install Python deps if needed for AI models
142- if [ "${{ steps.ai-cache.outputs.cache-hit }}" != "true" ]; then
143- echo "Installing Python dependencies..."
144- pip install --upgrade pip
145- pip install transformers torch optimum[exporters] onnxruntime
146- fi
147-
148- # Build missing WASM assets
149- if [ "${{ steps.yoga-cache.outputs.cache-hit }}" != "true" ]; then
150- echo "Building Yoga Layout WASM..."
151- pnpm --filter @socketsecurity/yoga-layout run build
152- fi
153-
154- if [ "${{ steps.ai-cache.outputs.cache-hit }}" != "true" ]; then
155- echo "Building AI models..."
156- pnpm --filter @socketbin/cli-ai run build
157- fi
158-
159- if [ "${{ steps.onnx-cache.outputs.cache-hit }}" != "true" ]; then
160- echo "Building ONNX Runtime..."
161- pnpm --filter @socketsecurity/onnx-runtime-builder run build
162- fi
163-
164- echo "✓ WASM assets built successfully"
165-
166- - name : Generate binary build cache key
167- id : build-cache-key
168- shell : bash
169- run : |
170- HASH=$(find patches packages/node-smol-builder/patches packages/node-smol-builder/additions scripts -type f \( -name "*.patch" -o -name "*.mjs" -o -name "*.h" -o -name "*.c" -o -name "*.cc" \) | sort | xargs shasum -a 256 | shasum -a 256 | cut -d' ' -f1)
171- echo "hash=$HASH" >> $GITHUB_OUTPUT
172-
173- - name : Restore smol binary cache
174- uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
175- with :
176- path : packages/node-smol-builder/dist/socket-smol-linux-x64
177- key : node-smol-linux-x64-${{ steps.build-cache-key.outputs.hash }}
178- restore-keys : node-smol-linux-x64-
179-
180- - name : Restore SEA binary cache
181- uses : actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
182- with :
183- path : packages/node-sea-builder/dist/socket-sea-linux-x64
184- key : node-sea-linux-x64-${{ steps.build-cache-key.outputs.hash }}
185- restore-keys : node-sea-linux-x64-
186-
18766 - name : Build CLI
18867 working-directory : packages/cli
18968 run : pnpm run build
19069
19170 - name : Run e2e tests
19271 working-directory : packages/cli
19372 env :
194- TEST_SEA_BINARY : ' 1'
195- TEST_SMOL_BINARY : ' 1'
19673 SOCKET_CLI_API_TOKEN : ${{ secrets.SOCKET_CLI_API_TOKEN }}
19774 run : pnpm run e2e-tests
0 commit comments