Skip to content

Commit fb1127f

Browse files
committed
ci: verify the cargo-built macOS x64 binary links only system dylibs
The darwin-x64 package is built with plain cargo on a GitHub macOS runner, so the portability assertion added to the Nix derivation does not cover it and no other gate inspects it before staging. Fail the build action if otool -L reports any dylib outside /usr/lib or /System/Library, mirroring the assertion in package.nix. The check logic was exercised locally on macOS: a /usr/lib-linked binary passes and a Nix-store-linked binary fails with the offending path printed.
1 parent df7e1f6 commit fb1127f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • .github/actions/build-macos-cargo-native-package

‎.github/actions/build-macos-cargo-native-package/action.yaml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@ runs:
1414
shell: bash
1515
run: cargo build --manifest-path rust/Cargo.toml --release --bin ccusage
1616

17+
- name: Verify macOS binary links only system dylibs
18+
shell: bash
19+
env:
20+
BINARY: ${{ inputs.binary }}
21+
run: |
22+
otool -L "$BINARY"
23+
violations=$(otool -L "$BINARY" | tail -n +2 | awk '{print $1}' | grep -Ev '^(/usr/lib/|/System/Library/)' || true)
24+
if [ -n "$violations" ]; then
25+
echo "Found dylib dependencies that do not exist on end-user machines:" >&2
26+
echo "$violations" >&2
27+
exit 1
28+
fi
29+
1730
- name: Stage native package
1831
shell: bash
1932
env:

0 commit comments

Comments
 (0)