- Combined botserver and botui builds in single workflow - Removed bottest from CI (no test execution) - Deploy both binaries to STAGE-GBO system container via SSH - Simplified to single workflow file - Removed separate bottest.yaml and botui.yaml
69 lines
2.4 KiB
YAML
69 lines
2.4 KiB
YAML
name: BotServer CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "botserver/**"
|
|
- "botui/**"
|
|
- "botlib/**"
|
|
- ".forgejo/workflows/botserver.yaml"
|
|
- "Cargo.toml"
|
|
- "Cargo.lock"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: gbo
|
|
env:
|
|
CARGO_TARGET_DIR: /opt/gbo/work/target
|
|
RUSTC_WRAPPER: ""
|
|
PATH: /home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin
|
|
STAGE_SYSTEM_HOST: "10.0.3.10"
|
|
SYSTEM_USER: gbuser
|
|
|
|
steps:
|
|
- name: Setup
|
|
run: |
|
|
cd /opt/gbo/work/generalbots
|
|
git reset --hard HEAD
|
|
git clean -fd
|
|
git pull
|
|
git submodule update --init --recursive
|
|
mkdir -p /opt/gbo/work/target
|
|
mkdir -p /opt/gbo/bin
|
|
|
|
- name: Build BotServer and BotUI
|
|
run: |
|
|
cd /opt/gbo/work/generalbots
|
|
CARGO_BUILD_JOBS=4 cargo build -p botserver --bin botserver
|
|
CARGO_BUILD_JOBS=4 cargo build -p botui --bin botui
|
|
|
|
- name: Deploy to Stage
|
|
run: |
|
|
echo "=== Deploying BotServer and BotUI to Stage ==="
|
|
|
|
# Copy both binaries to stage system container
|
|
scp -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
|
|
/opt/gbo/work/target/debug/botserver \
|
|
${SYSTEM_USER}@${STAGE_SYSTEM_HOST}:/opt/gbo/bin/botserver-new
|
|
|
|
scp -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
|
|
/opt/gbo/work/target/debug/botui \
|
|
${SYSTEM_USER}@${STAGE_SYSTEM_HOST}:/opt/gbo/bin/botui-new
|
|
|
|
# Restart services on stage
|
|
ssh -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
|
|
${SYSTEM_USER}@${STAGE_SYSTEM_HOST} "\
|
|
sudo mv /opt/gbo/bin/botserver-new /opt/gbo/bin/botserver && \
|
|
sudo mv /opt/gbo/bin/botui-new /opt/gbo/bin/botui && \
|
|
sudo chmod +x /opt/gbo/bin/botserver /opt/gbo/bin/botui && \
|
|
sudo systemctl restart botserver && \
|
|
sudo systemctl restart ui"
|
|
|
|
sleep 10
|
|
|
|
# Health checks
|
|
ssh -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \
|
|
${SYSTEM_USER}@${STAGE_SYSTEM_HOST} "\
|
|
curl -sf http://localhost:8080/health && echo '✅ BotServer OK' || echo '❌ BotServer FAILED'; \
|
|
curl -sf http://localhost:3000/ && echo '✅ BotUI OK' || echo '❌ BotUI FAILED'"
|