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: RUSTC_WRAPPER: sccache CARGO_INCREMENTAL: "0" PATH: /home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin steps: - name: Setup run: | cd /opt/gbo/work/generalbots git pull git ls-files -z | xargs -0 touch -d "@$(git log -1 --format='%ct')" git log --oneline -1 - name: Build BotServer and BotUI run: | cd /opt/gbo/work/generalbots rustup default stable export RUSTC_WRAPPER=sccache echo "=== sccache stats before build ===" sccache --show-stats 2>/dev/null || echo "sccache not available" CARGO_BUILD_JOBS=6 cargo build -p botserver --bin botserver CARGO_BUILD_JOBS=6 cargo build -p botui --bin botui --release echo "=== sccache stats after build ===" sccache --show-stats 2>/dev/null || echo "sccache not available" - name: Deploy to Stage run: | echo "=== Deploying to Stage ===" scp -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \ /opt/gbo/work/generalbots/target/debug/botserver \ gbuser@system:/opt/gbo/bin/botserver-new scp -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \ /opt/gbo/work/generalbots/target/release/botui \ gbuser@system:/opt/gbo/bin/botui-new ssh -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \ gbuser@system \ "sudo systemctl stop botserver || true && \ sudo systemctl stop ui || true && \ 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 start botserver && \ sudo systemctl start ui" sleep 10 ssh -i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no \ gbuser@system \ "curl -sf http://localhost:5858/api/health && echo 'BotServer OK' || echo 'BotServer FAILED'; \ curl -sf http://localhost:3000/ && echo 'BotUI OK' || echo 'BotUI FAILED'"