generalbots/.forgejo/workflows/botserver-v2.yaml
Rodrigo Rodriguez (Pragmatismo) 91d0011ce7 CI: v18 - Use merge (not rebase), reset dirty state
- git reset --hard + git clean to avoid rebase conflicts
- Use git pull (merge) instead of pull --rebase
- Verified build times on runner:
  * botserver: 2s (incremental), 42s (cold)
  * botui: 9s (incremental)
2026-04-18 19:11:52 -03:00

58 lines
1.8 KiB
YAML

# HASH-BUSTER-20260418-CONTAINER-v18
# Dev machine approach: /opt/gbo/work/botserver
# Pre-installed globally: Rust, Node.js, Python, sccache
# NO REBASE - use merge to avoid conflicts
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
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs:
build:
runs-on: gbo
steps:
- name: Pull Latest
run: |
echo "=== Pull Latest ==="
cd /opt/gbo/work/botserver
git reset --hard HEAD
git clean -fd
git pull
# Remove .github submodule (causes auth issues)
rm -rf .github
grep -v "github" .gitmodules > .gitmodules.tmp || true
mv .gitmodules.tmp .gitmodules
# Initialize only required submodules
git submodule update --init --recursive botlib botserver
- name: Build BotServer Only
run: |
echo "=== Build BotServer ==="
cd /opt/gbo/work/botserver
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
if [ -f "$BINARY" ]; then
echo "Binary exists: $BINARY"
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