name: BotServer CI on: push: branches: [main] paths: - "botserver/**" - "botui/**" - "botlib/**" - ".forgejo/workflows/botserver.yaml" - "Cargo.toml" - "Cargo.lock" - "Cargo.lock" jobs: build: runs-on: gbo env: CARGO_INCREMENTAL: 1 RUSTFLAGS: "-C link-arg=-fuse-ld=mold" PATH: "/home/gbuser/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/sbin:/bin" steps: - name: Setup run: | cd /opt/gbo/work/generalbots if ! git pull; then echo "::error::Git pull failed. Please resolve conflicts manually." exit 1 fi git log --oneline -1 - name: Build BotServer and BotUI run: | cd /opt/gbo/work/generalbots rustup default stable export CARGO_HOME=/home/gbuser/.cargo export RUSTC_WRAPPER=sccache sccache --start-server || true CARGO_BUILD_JOBS=24 cargo build -p botserver --bin botserver CARGO_BUILD_JOBS=24 cargo build -p botui --bin botui --release --features embed-ui sccache --show-stats || true - 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 botui || 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 botui" 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:5859/ && echo 'BotUI OK' || echo 'BotUI FAILED'"