Skip to content

Commit 8e2d7e3

Browse files
moha-bekhclaude
andcommitted
ci: build both musl targets on every pull request
The released Linux artifacts are `aarch64-unknown-linux-musl` and `x86_64-unknown-linux-musl`, and nothing in CI built either: a break in the argp stub, in the kernel-header paths or in the aarch64 `-lgcc` link flag would have surfaced for the first time during a tag-triggered release. The throwaway spike workflow used to cover this and was deleted with the spike. Both legs build on a native runner, with no environment variables, which is also what keeps `.cargo/config.toml` honest -- it has to carry the whole recipe on its own. The assertions are `readelf`-based rather than a `file` string, since rustc emits a static-PIE for x86_64 musl and spells it differently from aarch64, and `codspeed exec-harness --version` / `codspeed memtrack --version` answer only if both CLIs really are linked in. Reported by Greptile on #531. Refs COD-3440 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c862935 commit 8e2d7e3

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,56 @@ jobs:
148148
mode: ${{ matrix.mode }}
149149
run: cargo codspeed run -p runner-shared
150150

151+
# The released Linux artifacts are musl, and nothing else here builds them, so
152+
# a break in the argp stub, the kernel-header paths or the aarch64 `-lgcc`
153+
# link flag would otherwise surface for the first time in a release.
154+
musl-build:
155+
runs-on: ${{ matrix.runner }}
156+
strategy:
157+
fail-fast: false
158+
matrix:
159+
include:
160+
- runner: ubuntu-latest
161+
target: x86_64-unknown-linux-musl
162+
- runner: ubuntu-24.04-arm
163+
target: aarch64-unknown-linux-musl
164+
steps:
165+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
166+
with:
167+
submodules: true
168+
- uses: ./.github/actions/install-rust
169+
with:
170+
cache-key: ${{ matrix.target }}
171+
- uses: ./.github/actions/install-bpf-deps
172+
- name: Install the musl toolchain
173+
run: |
174+
sudo apt-get install -y musl-tools linux-libc-dev
175+
rustup target add "${{ matrix.target }}"
176+
177+
# No environment variables: the whole recipe lives in `.cargo/config.toml`,
178+
# and a plain build is what proves it still stands on its own.
179+
- name: Build
180+
run: cargo build --bin codspeed --target "${{ matrix.target }}"
181+
182+
- name: Assert the artifact is static and carries both subcommands
183+
run: |
184+
BIN=target/${{ matrix.target }}/debug/codspeed
185+
file "$BIN"
186+
# Asserted through readelf rather than a `file` string: rustc emits a
187+
# static-PIE for x86_64 musl, which `file` spells differently from the
188+
# aarch64 one. What matters is that nothing is loaded at runtime.
189+
if readelf -d "$BIN" 2>/dev/null | grep -qE 'NEEDED|RPATH|RUNPATH'; then
190+
echo "the musl binary has a dynamic dependency"
191+
exit 1
192+
fi
193+
if readelf -lW "$BIN" 2>/dev/null | grep -q 'INTERP'; then
194+
echo "the musl binary requests a dynamic loader"
195+
exit 1
196+
fi
197+
# These answer only if the two CLIs really are linked in.
198+
"$BIN" exec-harness --version
199+
"$BIN" memtrack --version
200+
151201
check:
152202
runs-on: ubuntu-latest
153203
if: always()
@@ -158,6 +208,7 @@ jobs:
158208
- basic-run-test
159209
- macos-basic-run-test
160210
- bpf-tests
211+
- musl-build
161212
- benchmarks
162213
steps:
163214
- uses: re-actors/alls-green@release/v1

0 commit comments

Comments
 (0)