Skip to content

Commit e84c3e4

Browse files
committed
fix(ci): correct SEA binary build for cross-platform compilation
- Pass --platform and --arch flags to build script for target architecture - Update cache path from single binary to dist/sea/ directory - Fix binary name patterns in verify step (socket-win-*, socket-macos-*, socket-linux-*) - Update artifact upload paths to match actual output locations This fixes builds failing to create binaries for non-native architectures (e.g., arm64 on x64 runners).
1 parent 98bd469 commit e84c3e4

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

.github/workflows/build-sea.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ jobs:
189189
id: sea-cache
190190
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
191191
with:
192-
path: packages/node-sea-builder/dist/socket-sea-${{ matrix.platform }}-${{ matrix.arch }}
192+
path: packages/node-sea-builder/dist/sea/
193193
key: node-sea-${{ matrix.platform }}-${{ matrix.arch }}-${{ steps.sea-cache-key.outputs.hash }}
194194
restore-keys: node-sea-${{ matrix.platform }}-${{ matrix.arch }}-
195195

@@ -199,33 +199,42 @@ jobs:
199199

200200
- name: Build SEA binary
201201
if: steps.sea-cache.outputs.cache-hit != 'true' || inputs.force
202-
run: pnpm --filter @socketbin/node-sea-builder run build
202+
run: pnpm --filter @socketbin/node-sea-builder run build -- --platform=${{ matrix.platform }} --arch=${{ matrix.arch }}
203203

204204
- name: Verify SEA binary
205205
shell: bash
206206
run: |
207207
echo "=== SEA Binary Build Artifacts ==="
208-
mkdir -p packages/node-sea-builder/dist
209-
ls -lh packages/node-sea-builder/dist/
208+
mkdir -p packages/node-sea-builder/dist/sea
209+
ls -lh packages/node-sea-builder/dist/sea/ || true
210210
echo ""
211-
BINARY_PATH="packages/node-sea-builder/dist/socket-sea-${{ matrix.platform }}-${{ matrix.arch }}"
212-
if [ -f "$BINARY_PATH" ] || [ -f "${BINARY_PATH}.exe" ]; then
213-
if [ "${{ matrix.os }}" = "windows" ]; then
214-
echo "socket-sea-${{ matrix.platform }}-${{ matrix.arch }}.exe size: $(du -h ${BINARY_PATH}.exe | cut -f1)"
215-
else
216-
echo "socket-sea-${{ matrix.platform }}-${{ matrix.arch }} size: $(du -h $BINARY_PATH | cut -f1)"
217-
fi
211+
212+
# Determine binary name based on platform
213+
if [ "${{ matrix.platform }}" = "win32" ]; then
214+
BINARY_NAME="socket-win-${{ matrix.arch }}.exe"
215+
elif [ "${{ matrix.platform }}" = "darwin" ]; then
216+
BINARY_NAME="socket-macos-${{ matrix.arch }}"
217+
else
218+
BINARY_NAME="socket-${{ matrix.platform }}-${{ matrix.arch }}"
219+
fi
220+
221+
BINARY_PATH="packages/node-sea-builder/dist/sea/$BINARY_NAME"
222+
if [ -f "$BINARY_PATH" ]; then
223+
echo "$BINARY_NAME size: $(du -h $BINARY_PATH | cut -f1)"
218224
else
219-
echo "⚠️ Binary not found at expected path"
225+
echo "⚠️ Binary not found at expected path: $BINARY_PATH"
226+
echo "Contents of dist/sea:"
227+
ls -la packages/node-sea-builder/dist/sea/ || echo "Directory does not exist"
220228
fi
221229
222230
- name: Upload SEA binary
223231
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
224232
with:
225233
name: socket-sea-${{ matrix.platform }}-${{ matrix.arch }}
226234
path: |
227-
packages/node-sea-builder/dist/socket-sea-${{ matrix.platform }}-${{ matrix.arch }}
228-
packages/node-sea-builder/dist/socket-sea-${{ matrix.platform }}-${{ matrix.arch }}.exe
235+
packages/node-sea-builder/dist/sea/socket-win-${{ matrix.arch }}.exe
236+
packages/node-sea-builder/dist/sea/socket-macos-${{ matrix.arch }}
237+
packages/node-sea-builder/dist/sea/socket-${{ matrix.platform }}-${{ matrix.arch }}
229238
retention-days: 7
230239
if-no-files-found: warn
231240

0 commit comments

Comments
 (0)