Skip to content

Commit 1bad487

Browse files
lklimekclaude
andcommitted
ci: add binary dependency verification for Linux, macOS, and Flatpak
Add post-build sanity checks to catch missing or unexpected shared library dependencies before release artifacts are published: - Linux: ldd check with allowlist, fail on "not found" - macOS (ARM64 + x86): otool -L check, fail on non-system libs - Flatpak: ldd check inside build-dir, fail on "not found" Complements the Windows PE verification from #769. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c8700bb commit 1bad487

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

.github/workflows/flatpak.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ jobs:
9090
run: |
9191
flatpak-builder --force-clean --repo=flatpak-repo build-dir flatpak/org.dash.DashEvoTool.yml
9292
93+
94+
- name: Verify Flatpak binary dependencies
95+
run: |
96+
BINARY="build-dir/files/bin/dash-evo-tool"
97+
if [ ! -f "$BINARY" ]; then
98+
echo "::error::Binary not found at $BINARY"
99+
exit 1
100+
fi
101+
echo "Checking shared library dependencies..."
102+
DEPS=$(ldd "$BINARY" 2>&1 || true)
103+
echo "$DEPS"
104+
# Fail on missing libraries (not found = will crash at runtime)
105+
if echo "$DEPS" | grep -q "not found"; then
106+
echo "::error::Binary has missing shared library dependencies"
107+
echo "$DEPS" | grep "not found"
108+
exit 1
109+
fi
110+
echo "✅ Flatpak binary dependencies look clean"
111+
93112
- name: Create Flatpak bundle
94113
run: |
95114
flatpak build-bundle flatpak-repo dash-evo-tool-linux-${{ matrix.arch }}.flatpak org.dash.DashEvoTool

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,26 @@ jobs:
121121
done
122122
echo "✅ Binary is self-contained — no MinGW runtime or null DLL dependencies"
123123
124+
- name: Verify Linux binary dependencies
125+
if: ${{ contains(matrix.target, 'linux') }}
126+
run: |
127+
echo "Checking shared library dependencies..."
128+
DEPS=$(ldd dash-evo-tool/dash-evo-tool)
129+
echo "$DEPS"
130+
# Allowlist: only standard system libraries should appear
131+
UNEXPECTED=$(echo "$DEPS" | grep "=>" | grep -v "not found" | awk '{print $1}' | grep -Ev "^(linux-vdso|libm|libc|libdl|librt|libpthread|libgcc_s|libstdc\+\+|ld-linux|libz|libssl|libcrypto)\.so")
132+
if [ -n "$UNEXPECTED" ]; then
133+
echo "::warning::Unexpected shared dependencies found:"
134+
echo "$UNEXPECTED"
135+
fi
136+
# Fail on missing libraries
137+
if echo "$DEPS" | grep -q "not found"; then
138+
echo "::error::Binary has missing shared library dependencies"
139+
echo "$DEPS" | grep "not found"
140+
exit 1
141+
fi
142+
echo "✅ Linux binary dependencies look clean"
143+
124144
- name: Package release
125145
run: |
126146
zip -r dash-evo-tool-${{ matrix.platform }}.zip dash-evo-tool/
@@ -252,6 +272,27 @@ jobs:
252272
</plist>
253273
EOF
254274
275+
276+
- name: Verify macOS binary dependencies
277+
run: |
278+
echo "Checking dynamic library dependencies..."
279+
DEPS=$(otool -L build/dash-evo-tool)
280+
echo "$DEPS"
281+
# Only system libraries (/usr/lib/) and frameworks (/System/Library/) are allowed
282+
UNEXPECTED=$(echo "$DEPS" | tail -n +2 | awk '{print $1}' | grep -Ev "^(/usr/lib/|/System/Library/|@rpath/)")
283+
if [ -n "$UNEXPECTED" ]; then
284+
echo "::error::Binary links non-system libraries:"
285+
echo "$UNEXPECTED"
286+
exit 1
287+
fi
288+
# Warn on @rpath dependencies (acceptable for frameworks but worth noting)
289+
RPATH=$(echo "$DEPS" | tail -n +2 | awk '{print $1}' | grep "^@rpath/")
290+
if [ -n "$RPATH" ]; then
291+
echo "::warning::Binary has @rpath dependencies (verify these are bundled):"
292+
echo "$RPATH"
293+
fi
294+
echo "✅ macOS binary dependencies look clean"
295+
255296
- name: Import signing certificates
256297
uses: Apple-Actions/import-codesign-certs@v3
257298
with:
@@ -520,6 +561,27 @@ jobs:
520561
</plist>
521562
EOF
522563
564+
565+
- name: Verify macOS binary dependencies
566+
run: |
567+
echo "Checking dynamic library dependencies..."
568+
DEPS=$(otool -L build/dash-evo-tool)
569+
echo "$DEPS"
570+
# Only system libraries (/usr/lib/) and frameworks (/System/Library/) are allowed
571+
UNEXPECTED=$(echo "$DEPS" | tail -n +2 | awk '{print $1}' | grep -Ev "^(/usr/lib/|/System/Library/|@rpath/)")
572+
if [ -n "$UNEXPECTED" ]; then
573+
echo "::error::Binary links non-system libraries:"
574+
echo "$UNEXPECTED"
575+
exit 1
576+
fi
577+
# Warn on @rpath dependencies (acceptable for frameworks but worth noting)
578+
RPATH=$(echo "$DEPS" | tail -n +2 | awk '{print $1}' | grep "^@rpath/")
579+
if [ -n "$RPATH" ]; then
580+
echo "::warning::Binary has @rpath dependencies (verify these are bundled):"
581+
echo "$RPATH"
582+
fi
583+
echo "✅ macOS binary dependencies look clean"
584+
523585
- name: Import signing certificates
524586
uses: Apple-Actions/import-codesign-certs@v3
525587
with:

0 commit comments

Comments
 (0)