Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,17 +418,24 @@ jobs:
- run: pnpm exec ferric --apple
working-directory: packages/ferric-example
- name: Inspect the structure of the prebuilt binary
run: lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-info.txt
run: |
lipo -info ferric_example.apple.node/*/libferric_example.framework/libferric_example > lipo-output.txt
otool -L ferric_example.apple.node/*/libferric_example.framework/libferric_example > otool-output.txt
working-directory: packages/ferric-example
- name: Upload lipo info
- name: Upload lipo output
uses: actions/upload-artifact@v7
with:
name: lipo-output
path: packages/ferric-example/lipo-output.txt
- name: Upload otool output
uses: actions/upload-artifact@v7
with:
name: lipo-info
path: packages/ferric-example/lipo-info.txt
name: otool-output
path: packages/ferric-example/otool-output.txt
- name: Verify Apple triplet builds
run: |
# Create expected fixture content
cat > expected-lipo-info.txt << 'EOF'
cat > expected-lipo-output.txt << 'EOF'
Architectures in the fat file: ferric_example.apple.node/ios-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
Architectures in the fat file: ferric_example.apple.node/macos-arm64_x86_64/libferric_example.framework/libferric_example are: x86_64 arm64
Architectures in the fat file: ferric_example.apple.node/tvos-arm64_x86_64-simulator/libferric_example.framework/libferric_example are: x86_64 arm64
Expand All @@ -438,5 +445,24 @@ jobs:
Non-fat file: ferric_example.apple.node/xros-arm64/libferric_example.framework/libferric_example is architecture: arm64
EOF
# Compare with expected fixture (will fail if files differ)
diff expected-lipo-info.txt lipo-info.txt
diff expected-lipo-output.txt lipo-output.txt
# Verify every binary depends on the weak-node-api framework.
# otool -L prints one header line per file, or one per architecture
# when the file is fat, so the number of headers is exactly the number
# of weak-node-api dependencies we expect. Deriving it beats
# hard-coding a count, which silently rots whenever a triplet is added
# or dropped.
# macOS frameworks use the versioned bundle layout, so their install
# name is .../weak-node-api.framework/Versions/<version>/weak-node-api
# where the embedded platforms get the flat
# .../weak-node-api.framework/weak-node-api — hence the optional
# "Versions/<version>/" in the pattern.
SLICE_COUNT=$(grep -c "^ferric_example\.apple\.node/.*:$" otool-output.txt || true)
WEAK_NODE_API_COUNT=$(grep -cE "@rpath/weak-node-api\.framework/(Versions/[^/]+/)?weak-node-api" otool-output.txt || true)
echo "Found $WEAK_NODE_API_COUNT weak-node-api dependencies across $SLICE_COUNT binaries"
if [ "$SLICE_COUNT" -eq 0 ] || [ "$WEAK_NODE_API_COUNT" -ne "$SLICE_COUNT" ]; then
echo "Expected $SLICE_COUNT dependencies on the weak-node-api framework (one per binary), found $WEAK_NODE_API_COUNT"
cat otool-output.txt
exit 1
fi
working-directory: packages/ferric-example
Loading