generalbots/.forgejo/workflows/botserver-v2.yaml
Rodrigo Rodriguez (Pragmatismo) fc9c4b7bdf CI: v15 - Work folder /opt/gbo/work/, build all 3 projects
- Use /opt/gbo/work/gb/ as working directory
- Build botserver, botui, botlib
- Pull --rebase (no clone if exists)
- Verified: all 3 projects compile with 0 errors
2026-04-18 18:37:04 -03:00

60 lines
1.7 KiB
YAML

# HASH-BUSTER-20260418-CONTAINER-v15
# Dev machine approach: work folder is /opt/gbo/work/
# Pre-installed: Rust, Node, Python, sccache on runner
name: BotServer CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
SCCACHE_DIR: /opt/gbo/work/.sccache
CARGO_TARGET_DIR: /opt/gbo/work/target
RUSTC_WRAPPER: sccache
jobs:
build:
runs-on: gbo
steps:
- name: Pull Latest
run: |
echo "=== Pull Latest ==="
cd /opt/gbo/work
if [ ! -d "gb" ]; then
git clone https://alm.pragmatismo.com.br/GeneralBots/gb.git
fi
cd /opt/gbo/work/gb
git pull --rebase
cd /opt/gbo/work/gb/botserver
git pull --rebase
cd /opt/gbo/work/gb/botlib
git pull --rebase
- name: Build
run: |
echo "=== Build ==="
cd /opt/gbo/work/gb
cargo build -p botserver
cargo build -p botui
cargo build -p botlib
ls -lh target/debug/botserver
ls -lh target/debug/botui
- name: Deploy
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/work/gb/target/debug/botserver"
if [ -f "$BINARY" ]; then
echo "Binary exists: $BINARY"
# Copy to system container
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system@localhost \
"bash -c 'cd /opt/gbo/bin && pkill -f botserver || true; sleep 2'"
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system@localhost \
"bash -c 'cp $BINARY /opt/gbo/bin/botserver && systemctl restart botserver'"
echo "Deploy completed"
else
echo "ERROR: Binary not found at $BINARY"
exit 1
fi