Skip to content

Commit 748f4b1

Browse files
Michael YuanMichael Yuan
authored andcommitted
Add static linking verification to release CI
- Linux musl: verify ldd reports 'not a dynamic executable' - macOS: print otool -L for inspection - Windows: file output check - Fails the build if Linux binary is dynamically linked
1 parent 857819d commit 748f4b1

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,31 @@ jobs:
7373
# For Windows GNU, link statically
7474
RUSTFLAGS: ${{ matrix.target == 'x86_64-pc-windows-gnu' && '-C target-feature=+crt-static' || '' }}
7575

76+
- name: Verify static linking
77+
run: |
78+
bin="target/${{ matrix.target }}/release/fintool"
79+
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
80+
bin="${bin}.exe"
81+
fi
82+
echo "=== Binary info ==="
83+
file "$bin"
84+
if [[ "${{ matrix.target }}" == *"linux-musl"* ]]; then
85+
# musl binaries should be statically linked
86+
if ldd "$bin" 2>&1 | grep -q "not a dynamic executable\|statically linked"; then
87+
echo "✅ Static binary confirmed"
88+
else
89+
echo "❌ Binary is dynamically linked!"
90+
ldd "$bin"
91+
exit 1
92+
fi
93+
elif [[ "${{ matrix.target }}" == *"apple-darwin"* ]]; then
94+
# macOS: check no non-system dylibs
95+
echo "Dynamic libraries:"
96+
otool -L "$bin" || true
97+
elif [[ "${{ matrix.target }}" == *"windows"* ]]; then
98+
echo "Windows binary — static check via file output above"
99+
fi
100+
76101
- name: Package zip
77102
run: |
78103
dir="${{ matrix.artifact }}"

0 commit comments

Comments
 (0)