Fix CI: Restore botlib and gb-ws workspaces, add --depth 1
Some checks failed
BotServer CI/CD / build (push) Failing after 11m18s
Some checks failed
BotServer CI/CD / build (push) Failing after 11m18s
- Restore botlib repository with --depth 1 fetch - Restore gb-ws workspace from /opt/gbo/data/gb - Use --depth 1 for all clone operations (faster) - Build with --features chat flag 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
74d820fbde
commit
5a1677bf2e
1 changed files with 18 additions and 31 deletions
|
|
@ -28,34 +28,28 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $WORKSPACE
|
mkdir -p $WORKSPACE
|
||||||
cd $WORKSPACE
|
cd $WORKSPACE
|
||||||
# Update or clone botserver (preserve git history for sccache fingerprints)
|
# Update or clone botlib
|
||||||
if [ -d botserver/.git ]; then
|
if [ -d botlib/.git ]; then
|
||||||
git -C botserver pull origin main
|
git -C botlib fetch --depth 1 origin main && git -C botlib checkout FETCH_HEAD
|
||||||
else
|
else
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
|
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git botlib
|
||||||
fi
|
fi
|
||||||
# Clean existing .git to avoid conflicts
|
# Update or clone botserver
|
||||||
rm -rf /opt/gbo/data/botserver/.git 2>/dev/null || true
|
if [ -d botserver/.git ]; then
|
||||||
# Check if workspace is valid git repo before cloning
|
git -C botserver fetch --depth 1 origin main && git -C botserver checkout FETCH_HEAD
|
||||||
if [ -d /opt/gbo/data/botserver/.git ]; then
|
|
||||||
echo "Workspace is valid git repo, using pull"
|
|
||||||
git -C /opt/gbo/data/botserver pull origin main || true
|
|
||||||
else
|
else
|
||||||
echo "Workspace is not a git repo, cloning fresh"
|
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git /opt/gbo/data/botserver
|
|
||||||
fi
|
fi
|
||||||
# Get workspace Cargo.toml from gb and strip unused members
|
# Get workspace Cargo.toml from gb and strip unused members
|
||||||
if [ -d /opt/gbo/data/botserver/.git ]; then
|
if [ -d /opt/gbo/data/gb-ws/.git ]; then
|
||||||
git -C /opt/gbo/data/botserver pull origin main
|
git -C /opt/gbo/data/gb-ws fetch --depth 1 origin main && git -C /opt/gbo/data/gb-ws checkout FETCH_HEAD
|
||||||
else
|
else
|
||||||
git clone --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /opt/gbo/data/botserver
|
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /opt/gbo/data/gb-ws
|
||||||
fi
|
fi
|
||||||
cp /opt/gbo/data/botserver/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
|
|
||||||
mkdir -p target
|
|
||||||
|
|
||||||
- name: Install system dependencies
|
- name: Install system dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -74,21 +68,14 @@ jobs:
|
||||||
- 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
|
sccache --start-server 2>/dev/null || true
|
||||||
export SCCACHE_CACHE_SIZE=10G
|
cargo build -p botserver --features chat -j 8 2>&1 | tee /tmp/build.log
|
||||||
sccache --stop-server 2>/dev/null || true
|
|
||||||
sleep 1
|
|
||||||
sccache --start-server
|
|
||||||
cargo build -p botserver -j 8 2>&1 | tee /tmp/build.log
|
|
||||||
echo "=== sccache stats ==="
|
|
||||||
sccache --show-stats
|
sccache --show-stats
|
||||||
echo "=== Binary info ==="
|
|
||||||
ls -lh target/debug/botserver
|
ls -lh target/debug/botserver
|
||||||
stat -c '%y' target/debug/botserver
|
|
||||||
|
|
||||||
- name: Save build log
|
- name: Save build log
|
||||||
if: always()
|
if: always()
|
||||||
run: cp /tmp/build.log /tmp/botserver$(date +%Y%m%d-%H%M%S).log || true
|
run: cp /tmp/build.log /tmp/botserver-$(date +%Y%m%d-%H%M%S).log || true
|
||||||
|
|
||||||
- name: Deploy via ssh tar gzip
|
- name: Deploy via ssh tar gzip
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -98,11 +85,11 @@ jobs:
|
||||||
echo "Step 1: Checking binary..."
|
echo "Step 1: Checking binary..."
|
||||||
ls -lh /opt/gbo/data/botserver/target/debug/botserver
|
ls -lh /opt/gbo/data/botserver/target/debug/botserver
|
||||||
echo "Step 2: Backing up old binary..."
|
echo "Step 2: Backing up old binary..."
|
||||||
ssh $SSH_ARGS system "cp /opt/gbo/bin/botserver /tmp/botserver.bak 2>/dev/null || true"
|
ssh $SSH_ARGS system "cp /opt/gbo/bin/botserver /tmp/botserver.bak"
|
||||||
echo "Step 3: Stopping botserver service..."
|
echo "Step 3: Stopping botserver service..."
|
||||||
ssh $SSH_ARGS system "sudo systemctl stop botserver || true"
|
ssh $SSH_ARGS system "sudo systemctl stop botserver || true"
|
||||||
echo "Step 4: Transferring new binary..."
|
echo "Step 4: Transferring new binary..."
|
||||||
tar cf -C /opt/gbo/data/botserver/target/debug botserver | gzip -1 | ssh $SSH_ARGS system "gzip -d | tar xf - -C /opt/gbo/bin && chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && echo 'Transfer complete'"
|
tar cf - -C /opt/gbo/data/botserver/target/debug botserver | gzip -1 | ssh $SSH_ARGS system "gzip -d | tar xf - -C /opt/gbo/bin && chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && echo 'Transfer complete'"
|
||||||
echo "Step 5: Starting botserver service..."
|
echo "Step 5: Starting botserver service..."
|
||||||
ssh $SSH_ARGS system "sudo systemctl start botserver && echo 'Botserver started'"
|
ssh $SSH_ARGS system "sudo systemctl start botserver && echo 'Botserver started'"
|
||||||
echo "=== Deploy completed ==="
|
echo "=== Deploy completed ==="
|
||||||
|
|
@ -115,4 +102,4 @@ jobs:
|
||||||
|
|
||||||
- name: Save deploy log
|
- name: Save deploy log
|
||||||
if: always()
|
if: always()
|
||||||
run: cp /tmp/deploy.log /tmp/deploy$(date +%Y%m%d-%H%M%S).log || true
|
run: cp /tmp/deploy.log /tmp/deploy-$(date +%Y%m%d-%H%M%S).log || true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue