Skip to content

Commit edf07cf

Browse files
committed
ci: verify the ferric Apple binaries depend on weak-node-api
Extends the "Test ferric Apple triplets" job so it doesn't only assert which architectures were produced, but also that each produced binary actually links the weak-node-api framework, catching regressions where a triplet builds but drops the dependency. The expected number of `@rpath/weak-node-api.framework/weak-node-api` lines is derived from the otool output itself — `otool -L` prints one header per file, or one per architecture for fat files — rather than hard-coded, so it doesn't rot when a triplet is added or dropped. Also renames lipo-info.txt to lipo-output.txt for symmetry with the new otool-output.txt, and uploads both as artifacts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SrPdjhQ6aG949mVDDaiT2U
1 parent 7debd88 commit edf07cf

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

.github/workflows/check.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,17 +418,24 @@ jobs:
418418
- run: pnpm exec ferric --apple
419419
working-directory: packages/ferric-example
420420
- name: Inspect the structure of the prebuilt binary
421-
run: lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-info.txt
421+
run: |
422+
lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-output.txt
423+
otool -L ferric_example.apple.node/*/libferric_example.framework/libferric_example > otool-output.txt
422424
working-directory: packages/ferric-example
423-
- name: Upload lipo info
425+
- name: Upload lipo output
426+
uses: actions/upload-artifact@v7
427+
with:
428+
name: lipo-output
429+
path: packages/ferric-example/lipo-output.txt
430+
- name: Upload otool output
424431
uses: actions/upload-artifact@v7
425432
with:
426-
name: lipo-info
427-
path: packages/ferric-example/lipo-info.txt
433+
name: otool-output
434+
path: packages/ferric-example/otool-output.txt
428435
- name: Verify Apple triplet builds
429436
run: |
430437
# Create expected fixture content
431-
cat > expected-lipo-info.txt << 'EOF'
438+
cat > expected-lipo-output.txt << 'EOF'
432439
Architectures in the fat file: ferric_example.apple.node/ios-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
433440
Architectures in the fat file: ferric_example.apple.node/macos-arm64_x86_64/libferric_example.framework/libferric_example are: x86_64 arm64
434441
Architectures in the fat file: ferric_example.apple.node/tvos-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
@@ -438,5 +445,19 @@ jobs:
438445
Non-fat file: ferric_example.apple.node/xros-arm64/libferric_example.framework/libferric_example is architecture: arm64
439446
EOF
440447
# Compare with expected fixture (will fail if files differ)
441-
diff expected-lipo-info.txt lipo-info.txt
448+
diff expected-lipo-output.txt lipo-output.txt
449+
# Verify every binary depends on the weak-node-api framework.
450+
# otool -L prints one header line per file, or one per architecture
451+
# when the file is fat, so the number of headers is exactly the number
452+
# of "@rpath/weak-node-api.framework/weak-node-api" lines we expect.
453+
# Deriving it beats hard-coding a count, which silently rots whenever
454+
# a triplet is added or dropped.
455+
SLICE_COUNT=$(grep -c "^ferric_example\.apple\.node/.*:$" otool-output.txt || true)
456+
WEAK_NODE_API_COUNT=$(grep -c "@rpath/weak-node-api\.framework/weak-node-api" otool-output.txt || true)
457+
echo "Found $WEAK_NODE_API_COUNT weak-node-api dependencies across $SLICE_COUNT binaries"
458+
if [ "$SLICE_COUNT" -eq 0 ] || [ "$WEAK_NODE_API_COUNT" -ne "$SLICE_COUNT" ]; then
459+
echo "Expected $SLICE_COUNT occurrences of @rpath/weak-node-api.framework/weak-node-api (one per binary), found $WEAK_NODE_API_COUNT"
460+
cat otool-output.txt
461+
exit 1
462+
fi
442463
working-directory: packages/ferric-example

0 commit comments

Comments
 (0)