2026-04-18 18:50:22 -03:00
|
|
|
# HASH-BUSTER-20260418-CONTAINER-v16
|
|
|
|
|
# Dev machine approach: /opt/gbo/work/botserver
|
|
|
|
|
# Pre-installed globally: Rust, Node.js, Python, sccache
|
2026-04-18 17:27:23 -03:00
|
|
|
name: BotServer CI/CD
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
2026-04-18 16:33:51 -03:00
|
|
|
branches: [main]
|
2026-04-18 16:11:27 -03:00
|
|
|
pull_request:
|
2026-04-18 16:33:51 -03:00
|
|
|
branches: [main]
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2026-04-18 16:20:38 -03:00
|
|
|
env:
|
2026-04-18 17:27:23 -03:00
|
|
|
SCCACHE_DIR: /opt/gbo/work/.sccache
|
|
|
|
|
CARGO_TARGET_DIR: /opt/gbo/work/target
|
2026-04-18 18:26:36 -03:00
|
|
|
RUSTC_WRAPPER: sccache
|
2026-04-18 18:50:22 -03:00
|
|
|
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
2026-04-18 16:20:38 -03:00
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
jobs:
|
|
|
|
|
build:
|
2026-04-18 16:20:38 -03:00
|
|
|
runs-on: gbo
|
2025-12-16 13:25:26 -03:00
|
|
|
steps:
|
2026-04-18 18:31:59 -03:00
|
|
|
- name: Pull Latest
|
2026-04-18 18:26:36 -03:00
|
|
|
run: |
|
2026-04-18 18:31:59 -03:00
|
|
|
echo "=== Pull Latest ==="
|
2026-04-18 18:50:22 -03:00
|
|
|
cd /opt/gbo/work/botserver
|
2026-04-18 18:31:59 -03:00
|
|
|
git pull --rebase
|
2026-04-18 18:50:22 -03:00
|
|
|
# Remove .github submodule (causes auth issues)
|
|
|
|
|
rm -rf .github
|
|
|
|
|
grep -v "github" .gitmodules > .gitmodules.tmp || true
|
|
|
|
|
mv .gitmodules.tmp .gitmodules
|
|
|
|
|
# Initialize all submodules
|
|
|
|
|
git submodule update --init --recursive
|
2026-04-18 18:03:31 -03:00
|
|
|
|
2026-04-18 18:26:36 -03:00
|
|
|
- name: Build
|
|
|
|
|
run: |
|
|
|
|
|
echo "=== Build ==="
|
2026-04-18 18:50:22 -03:00
|
|
|
cd /opt/gbo/work/botserver
|
2026-04-18 18:26:36 -03:00
|
|
|
cargo build -p botserver
|
2026-04-18 18:37:04 -03:00
|
|
|
cargo build -p botui
|
|
|
|
|
cargo build -p botlib
|
2026-04-18 18:26:36 -03:00
|
|
|
ls -lh target/debug/botserver
|
2026-04-18 18:37:04 -03:00
|
|
|
ls -lh target/debug/botui
|
2026-04-18 18:03:31 -03:00
|
|
|
|
2026-04-18 18:26:36 -03:00
|
|
|
- name: Deploy
|
|
|
|
|
run: |
|
|
|
|
|
echo "=== Deploy ==="
|
2026-04-18 18:50:22 -03:00
|
|
|
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
|
2026-04-18 18:26:36 -03:00
|
|
|
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
|