Skip to content

Commit a10e624

Browse files
authored
fix(ci): install libstdc++/libgcc for Alpine smoke test and add musl to PR matrix (#765)
## Summary Fixes the `Build Binary (linux-x64-musl)` failure on main introduced by #762. Bun's musl binaries dynamically link `libstdc++` and `libgcc_s`, which aren't included in bare `alpine:latest`. The smoke test now installs these before running the binary. Also adds `linux-x64-musl` to the PR build matrix so musl issues are caught before merging.
1 parent 54fad1a commit a10e624

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ jobs:
6666
{
6767
echo 'matrix<<MATRIX_EOF'
6868
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
69-
# PRs only need linux-x64 for smoke test and e2e — skip macOS/Windows
69+
# PRs build linux-x64 (smoke test + e2e) and linux-x64-musl (Alpine smoke test)
7070
echo '{"include":[
71-
{"target":"linux-x64", "os":"ubuntu-latest", "can-test":true}
71+
{"target":"linux-x64", "os":"ubuntu-latest", "can-test":true},
72+
{"target":"linux-x64-musl", "os":"ubuntu-latest", "can-test":false}
7273
]}'
7374
else
7475
# main, release/**, workflow_call: full cross-platform matrix
@@ -271,7 +272,7 @@ jobs:
271272
if: matrix.target == 'linux-x64-musl'
272273
run: |
273274
docker run --rm -v "$PWD/dist-bin:/dist-bin:ro" alpine:latest \
274-
/dist-bin/sentry-linux-x64-musl --help
275+
sh -c "apk add --no-cache libstdc++ libgcc >/dev/null 2>&1 && /dist-bin/sentry-linux-x64-musl --help"
275276
- name: Upload binary artifact
276277
uses: actions/upload-artifact@v7
277278
with:

‎install‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@ if [[ "$os" == "linux" ]]; then
167167
if detect_musl; then
168168
libc_suffix="-musl"
169169
libc_variant="musl"
170+
171+
# Bun musl binaries dynamically link libstdc++ and libgcc_s.
172+
# Auto-install them on Alpine when running as root (typical in Docker).
173+
# When not root, warn with install instructions.
174+
if ! ldconfig -p 2>/dev/null | grep -q libstdc++ && ! [ -f /usr/lib/libstdc++.so.6 ]; then
175+
if command -v apk >/dev/null 2>&1; then
176+
if [ "$(id -u)" = "0" ]; then
177+
echo -e "${MUTED}Installing required C++ runtime libraries...${NC}"
178+
apk add --no-cache libstdc++ libgcc >/dev/null 2>&1 \
179+
|| die "Failed to install libstdc++ and libgcc (required for musl binary)" "deps"
180+
else
181+
echo -e "${RED}Missing required libraries: libstdc++ libgcc${NC}" >&2
182+
echo -e "${RED}Run: apk add libstdc++ libgcc${NC}" >&2
183+
die "Cannot install dependencies without root. Run as root or install manually." "deps"
184+
fi
185+
fi
186+
fi
170187
fi
171188
fi
172189

0 commit comments

Comments
 (0)