Skip to content

Commit 5f8e15d

Browse files
jensensclaude
andcommitted
Fix Linux wheel build: don't exit before-script when PGO Python not found
The before-script-linux used `exit 0` when no Python was found in the manylinux container, which also aborted the subsequent maturin build command (they run in the same shell). Replace with if/else so PGO is skipped gracefully but the wheel build still runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 03c263e commit 5f8e15d

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
# PGO: Profile-guided optimization. Both targets build natively
4646
# on their respective runners, so PGO works for all Linux wheels.
4747
before-script-linux: |
48-
set -e
4948
echo "::group::PGO: Instrumented build + profiling"
5049
# Find best available Python (prefer 3.13, fallback to newest 3.x)
5150
PYDIR=$(find /opt/python -maxdepth 1 -name 'cp313-cp313' -type d 2>/dev/null | head -1)
@@ -55,32 +54,32 @@ jobs:
5554
if [ -z "$PYDIR" ] || [ ! -x "$PYDIR/bin/python" ]; then
5655
echo "PGO: No suitable Python found in container, skipping PGO"
5756
echo "::endgroup::"
58-
exit 0
59-
fi
60-
PYTHON="$PYDIR/bin/python"
61-
echo "PGO: Using $PYTHON"
57+
else
58+
PYTHON="$PYDIR/bin/python"
59+
echo "PGO: Using $PYTHON"
6260
63-
# 1. Install ZODB+BTrees for FileStorage benchmarks
64-
$PYTHON -m pip install --quiet ZODB BTrees
61+
# 1. Install ZODB+BTrees for FileStorage benchmarks
62+
$PYTHON -m pip install --quiet ZODB BTrees
6563
66-
# 2. Instrumented build
67-
RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" maturin develop --release -i $PYTHON
64+
# 2. Instrumented build
65+
RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" maturin develop --release -i $PYTHON
6866
69-
# 3. Generate profile data with real + synthetic workloads
70-
gunzip -k benchmarks/bench_data/Data.fs.gz
71-
$PYTHON benchmarks/bench.py filestorage benchmarks/bench_data/Data.fs
72-
$PYTHON benchmarks/bench.py synthetic --iterations 2000
67+
# 3. Generate profile data with real + synthetic workloads
68+
gunzip -k benchmarks/bench_data/Data.fs.gz || true
69+
$PYTHON benchmarks/bench.py filestorage benchmarks/bench_data/Data.fs
70+
$PYTHON benchmarks/bench.py synthetic --iterations 2000
7371
74-
# 4. Merge profiles and set RUSTFLAGS for the final build
75-
LLVM_PROFDATA=$(find /root/.rustup -name llvm-profdata 2>/dev/null | head -1 || true)
76-
if [ -n "$LLVM_PROFDATA" ] && ls /tmp/pgo-data/*.profraw 1>/dev/null 2>&1; then
77-
$LLVM_PROFDATA merge -o /tmp/pgo-data/merged.profdata /tmp/pgo-data/*.profraw
78-
export RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata"
79-
echo "PGO: Building with merged profile data"
80-
else
81-
echo "PGO: No profile data found, building without PGO"
72+
# 4. Merge profiles and set RUSTFLAGS for the final build
73+
LLVM_PROFDATA=$(find /root/.rustup -name llvm-profdata 2>/dev/null | head -1 || true)
74+
if [ -n "$LLVM_PROFDATA" ] && ls /tmp/pgo-data/*.profraw 1>/dev/null 2>&1; then
75+
$LLVM_PROFDATA merge -o /tmp/pgo-data/merged.profdata /tmp/pgo-data/*.profraw
76+
export RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata"
77+
echo "PGO: Building with merged profile data"
78+
else
79+
echo "PGO: No profile data found, building without PGO"
80+
fi
81+
echo "::endgroup::"
8282
fi
83-
echo "::endgroup::"
8483
- uses: actions/upload-artifact@v4
8584
with:
8685
name: wheels-linux-${{ matrix.target }}

0 commit comments

Comments
 (0)