ci: simplest - just git pull and cargo build
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
Some checks failed
BotServer CI/CD / build (push) Has been cancelled
This commit is contained in:
parent
db1dd37adc
commit
5e819c4714
1 changed files with 5 additions and 50 deletions
|
|
@ -29,45 +29,31 @@ jobs:
|
||||||
mkdir -p $WORKSPACE
|
mkdir -p $WORKSPACE
|
||||||
cd $WORKSPACE
|
cd $WORKSPACE
|
||||||
|
|
||||||
echo "=== Updating workspace ==="
|
# Clone or update repos
|
||||||
|
|
||||||
# Update or clone botlib
|
|
||||||
if [ -d botlib/.git ]; then
|
if [ -d botlib/.git ]; then
|
||||||
echo "Updating botlib..."
|
git -C botlib pull --ff-only origin main
|
||||||
git -C botlib pull --ff-only origin main || git -C botlib fetch origin main
|
|
||||||
else
|
else
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git botlib
|
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git botlib
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update or clone botserver
|
|
||||||
if [ -d botserver/.git ]; then
|
if [ -d botserver/.git ]; then
|
||||||
echo "Updating botserver..."
|
git -C botserver pull --ff-only origin main
|
||||||
git -C botserver pull --ff-only origin main || git -C botserver fetch origin main
|
|
||||||
else
|
else
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
|
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get workspace Cargo.toml from gb
|
|
||||||
if [ -d /opt/gbo/data/gb-ws/.git ]; then
|
if [ -d /opt/gbo/data/gb-ws/.git ]; then
|
||||||
git -C /opt/gbo/data/gb-ws pull --ff-only origin main || git -C /opt/gbo/data/gb-ws fetch origin main
|
git -C /opt/gbo/data/gb-ws pull --ff-only origin main
|
||||||
else
|
else
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /opt/gbo/data/gb-ws
|
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /opt/gbo/data/gb-ws
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only rebuild if there were actual changes
|
|
||||||
echo "$WORKSPACE" > /tmp/workspace_path
|
|
||||||
|
|
||||||
cp /opt/gbo/data/gb-ws/Cargo.toml Cargo.toml
|
cp /opt/gbo/data/gb-ws/Cargo.toml Cargo.toml
|
||||||
for m in botapp botdevice bottest botui botbook botmodels botplugin bottemplates; do
|
for m in botapp botdevice bottest botui botbook botmodels botplugin bottemplates; do
|
||||||
grep -v "\"$m\"" Cargo.toml > /tmp/c.toml && mv /tmp/c.toml Cargo.toml
|
grep -v "\"$m\"" Cargo.toml > /tmp/c.toml && mv /tmp/c.toml Cargo.toml
|
||||||
done
|
done
|
||||||
|
|
||||||
# Ensure target dir exists (use persistent location for sccache)
|
|
||||||
mkdir -p /opt/gbo/data/botserver/target
|
mkdir -p /opt/gbo/data/botserver/target
|
||||||
|
|
||||||
# Pre-fetch dependencies
|
|
||||||
cargo fetch 2>/dev/null || true
|
|
||||||
|
|
||||||
- name: Cache sccache
|
- name: Cache sccache
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
|
|
@ -96,40 +82,9 @@ jobs:
|
||||||
export SCCACHE_IDLE_TIMEOUT=300
|
export SCCACHE_IDLE_TIMEOUT=300
|
||||||
export SCCACHE_CACHE_SIZE=10G
|
export SCCACHE_CACHE_SIZE=10G
|
||||||
sccache --stop-server 2>/dev/null || true
|
sccache --stop-server 2>/dev/null || true
|
||||||
sleep 1
|
|
||||||
sccache --start-server
|
sccache --start-server
|
||||||
|
|
||||||
# Always build - too complex to detect changes reliably
|
cargo build -p botserver -j 8
|
||||||
# sccache will handle caching efficiently
|
|
||||||
|
|
||||||
cd /opt/gbo/data/botserver
|
|
||||||
echo "=== Starting build in background ==="
|
|
||||||
cargo build -p botserver -j 8 > /tmp/build.log 2>&1 &
|
|
||||||
BUILD_PID=$!
|
|
||||||
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()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue