fix: reduce runner CPU by running build in background

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-09 15:43:48 -03:00
parent e6a16428b9
commit 8dcc6679bb

View file

@ -67,20 +67,43 @@ jobs:
echo "All system dependencies already installed" echo "All system dependencies already installed"
fi fi
- name: Build BotServer - name: Build BotServer
working-directory: /opt/gbo/data/botserver working-directory: /opt/gbo/data/botserver
run: | run: |
export SCCACHE_IDLE_TIMEOUT=300 set -e
export SCCACHE_CACHE_SIZE=10G export SCCACHE_IDLE_TIMEOUT=300
sccache --stop-server 2>/dev/null || true export SCCACHE_CACHE_SIZE=10G
sleep 1 sccache --stop-server 2>/dev/null || true
sccache --start-server sleep 1
cargo build -p botserver -j 8 2>&1 | tee /tmp/build.log sccache --start-server
echo "=== sccache stats ==="
sccache --show-stats echo "=== Starting build in background ==="
echo "=== Binary info ===" cargo build -p botserver -j 8 > /tmp/build.log 2>&1 &
ls -lh target/debug/botserver BUILD_PID=$!
stat -c '%y' target/debug/botserver echo "Build PID: $BUILD_PID"
echo "=== Waiting for build to complete (PID: $BUILD_PID) ==="
while kill -0 $BUILD_PID 2>/dev/null; do
echo "Build in progress... (sleeping 30s)"
sleep 30
done
wait $BUILD_PID
EXIT_CODE=$?
echo "=== Build finished with exit code: $EXIT_CODE ==="
if [ $EXIT_CODE -ne 0 ]; then
echo "=== Build FAILED ==="
tail -100 /tmp/build.log
exit $EXIT_CODE
fi
echo "=== sccache stats ==="
sccache --show-stats
echo "=== Binary info ==="
ls -lh target/debug/botserver
stat -c '%y' target/debug/botserver
- name: Save build log - name: Save build log
if: always() if: always()