Skip to content

Commit 96209a8

Browse files
committed
Strip Linux release artifacts on native builders
1 parent 32b2f2d commit 96209a8

1 file changed

Lines changed: 43 additions & 21 deletions

File tree

.github/workflows/rust-release.yml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,39 @@ jobs:
172172
shell: bash
173173
run: cargo build --locked --target ${{ matrix.target }} --release -p codex-cli --bin codex
174174

175+
- name: Stage Unix binary artifact
176+
shell: bash
177+
run: |
178+
set -euo pipefail
179+
staged_dir="${RUNNER_TEMP}/release-bin/${{ matrix.target }}"
180+
rm -rf "${staged_dir}"
181+
mkdir -p "${staged_dir}"
182+
cp "target/${{ matrix.target }}/release/codex" "${staged_dir}/codex"
183+
184+
- name: Archive Linux symbols and strip staged binary
185+
if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
186+
shell: bash
187+
run: |
188+
set -euo pipefail
189+
staged_dir="${RUNNER_TEMP}/release-bin/${{ matrix.target }}"
190+
bash "${GITHUB_WORKSPACE}/.github/scripts/archive-release-symbols-and-strip-binaries.sh" \
191+
--target "${{ matrix.target }}" \
192+
--artifact-name "${{ matrix.target }}" \
193+
--release-dir "${staged_dir}" \
194+
--archive-dir "symbols-dist/${{ matrix.target }}" \
195+
--binaries "codex"
196+
175197
- uses: actions/upload-artifact@v7
176198
with:
177199
name: codex-bin-${{ matrix.target }}
178-
path: codex-rs/target/${{ matrix.target }}/release/codex
200+
path: ${{ runner.temp }}/release-bin/${{ matrix.target }}/codex
201+
if-no-files-found: error
202+
203+
- if: ${{ contains(matrix.target, 'unknown-linux-musl') }}
204+
uses: actions/upload-artifact@v7
205+
with:
206+
name: codex-symbols-${{ matrix.target }}
207+
path: codex-rs/symbols-dist/${{ matrix.target }}/*
179208
if-no-files-found: error
180209

181210
build-windows:
@@ -275,6 +304,12 @@ jobs:
275304
pattern: codex-bin-*
276305
path: ${{ runner.temp }}/artifacts
277306

307+
- name: Download Linux symbols artifacts
308+
uses: actions/download-artifact@v8
309+
with:
310+
pattern: codex-symbols-*
311+
path: ${{ runner.temp }}/symbols
312+
278313
- name: Stage release assets
279314
env:
280315
VERSION: ${{ steps.compute.outputs.release_version }}
@@ -314,6 +349,13 @@ jobs:
314349
zip -q -r "${out_dir}/codext-win32-x64-${VERSION}.zip" .
315350
)
316351
352+
symbols_root="${RUNNER_TEMP}/symbols"
353+
if [[ -d "${symbols_root}" ]]; then
354+
while IFS= read -r symbol_archive; do
355+
cp "${symbol_archive}" "${out_dir}/"
356+
done < <(find "${symbols_root}" -type f -name '*.tar.gz' | sort)
357+
fi
358+
317359
- name: Create or update GitHub Release
318360
env:
319361
GH_TOKEN: ${{ github.token }}
@@ -405,26 +447,6 @@ jobs:
405447
cp "${artifacts_root}/codex-bin-x86_64-pc-windows-msvc/codex-command-runner.exe" \
406448
"${vendor_root}/x86_64-pc-windows-msvc/codex/codex-command-runner.exe"
407449
408-
- name: Strip Linux binaries for npm packaging
409-
shell: bash
410-
run: |
411-
set -euo pipefail
412-
vendor_root="${RUNNER_TEMP}/npm-root/vendor"
413-
linux_targets=(
414-
x86_64-unknown-linux-musl
415-
aarch64-unknown-linux-musl
416-
)
417-
418-
for target in "${linux_targets[@]}"; do
419-
binary_path="${vendor_root}/${target}/codex/codex"
420-
if [[ ! -f "${binary_path}" ]]; then
421-
echo "Missing Linux binary for npm packaging: ${binary_path}"
422-
exit 1
423-
fi
424-
425-
strip --strip-debug --strip-unneeded "${binary_path}"
426-
done
427-
428450
- uses: facebook/install-dotslash@v2
429451

430452
- name: Install ripgrep payloads

0 commit comments

Comments
 (0)