Skip to content

Commit 7531199

Browse files
kraenhansenclaude
andcommitted
ci: verify the ferric Apple binaries depend on weak-node-api (#409)
* 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 * ci: accept the versioned weak-node-api install name on macOS The first CI run of this check reported 8 dependencies across 10 binary slices. The two misses were the macOS slices: macOS frameworks use the versioned bundle layout, so weak-node-api's install name there is @rpath/weak-node-api.framework/Versions/0.1.1/weak-node-api where iOS, tvOS and visionOS get the flat @rpath/weak-node-api.framework/weak-node-api Both are a genuine dependency on the framework, so match the optional "Versions/<version>/" component rather than only the flat form. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SrPdjhQ6aG949mVDDaiT2U --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8cc8e59 commit 7531199

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

.github/workflows/check.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,17 +474,24 @@ jobs:
474474
- run: pnpm exec ferric --apple
475475
working-directory: packages/ferric-example
476476
- name: Inspect the structure of the prebuilt binary
477-
run: lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-info.txt
477+
run: |
478+
lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-output.txt
479+
otool -L ferric_example.apple.node/*/libferric_example.framework/libferric_example > otool-output.txt
478480
working-directory: packages/ferric-example
479-
- name: Upload lipo info
481+
- name: Upload lipo output
482+
uses: actions/upload-artifact@v7
483+
with:
484+
name: lipo-output
485+
path: packages/ferric-example/lipo-output.txt
486+
- name: Upload otool output
480487
uses: actions/upload-artifact@v7
481488
with:
482-
name: lipo-info
483-
path: packages/ferric-example/lipo-info.txt
489+
name: otool-output
490+
path: packages/ferric-example/otool-output.txt
484491
- name: Verify Apple triplet builds
485492
run: |
486493
# Create expected fixture content
487-
cat > expected-lipo-info.txt << 'EOF'
494+
cat > expected-lipo-output.txt << 'EOF'
488495
Architectures in the fat file: ferric_example.apple.node/ios-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
489496
Architectures in the fat file: ferric_example.apple.node/macos-arm64_x86_64/libferric_example.framework/libferric_example are: x86_64 arm64
490497
Architectures in the fat file: ferric_example.apple.node/tvos-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
@@ -494,5 +501,24 @@ jobs:
494501
Non-fat file: ferric_example.apple.node/xros-arm64/libferric_example.framework/libferric_example is architecture: arm64
495502
EOF
496503
# Compare with expected fixture (will fail if files differ)
497-
diff expected-lipo-info.txt lipo-info.txt
504+
diff expected-lipo-output.txt lipo-output.txt
505+
# Verify every binary depends on the weak-node-api framework.
506+
# otool -L prints one header line per file, or one per architecture
507+
# when the file is fat, so the number of headers is exactly the number
508+
# of weak-node-api dependencies we expect. Deriving it beats
509+
# hard-coding a count, which silently rots whenever a triplet is added
510+
# or dropped.
511+
# macOS frameworks use the versioned bundle layout, so their install
512+
# name is .../weak-node-api.framework/Versions/<version>/weak-node-api
513+
# where the embedded platforms get the flat
514+
# .../weak-node-api.framework/weak-node-api — hence the optional
515+
# "Versions/<version>/" in the pattern.
516+
SLICE_COUNT=$(grep -c "^ferric_example\.apple\.node/.*:$" otool-output.txt || true)
517+
WEAK_NODE_API_COUNT=$(grep -cE "@rpath/weak-node-api\.framework/(Versions/[^/]+/)?weak-node-api" otool-output.txt || true)
518+
echo "Found $WEAK_NODE_API_COUNT weak-node-api dependencies across $SLICE_COUNT binaries"
519+
if [ "$SLICE_COUNT" -eq 0 ] || [ "$WEAK_NODE_API_COUNT" -ne "$SLICE_COUNT" ]; then
520+
echo "Expected $SLICE_COUNT dependencies on the weak-node-api framework (one per binary), found $WEAK_NODE_API_COUNT"
521+
cat otool-output.txt
522+
exit 1
523+
fi
498524
working-directory: packages/ferric-example

0 commit comments

Comments
 (0)