generalbots/.forgejo/workflows/botserver.yaml
Rodrigo Rodriguez (Pragmatismo) 867ba98585
Some checks failed
BotServer CI/CD / build (push) Failing after 10s
Fix CI: Combine all steps into single atomic run block
2026-04-17 18:47:01 -03:00

54 lines
1.9 KiB
YAML

name: BotServer CI/CD
on:
push:
branches: ["main"]
env:
CARGO_BUILD_JOBS: 8
jobs:
build:
runs-on: gbo
steps:
- name: Clone and Build
run: |
set -e
# Clean and setup
rm -rf ~/workspace ~/gb-ws
mkdir -p ~/workspace/target
mkdir -p ~/cache
cd ~/workspace
# Clone fresh
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git ~/gb-ws
# Setup Cargo.toml
cp ~/gb-ws/Cargo.toml ~/workspace/Cargo.toml
sed -i '/botapp\|botdevice\|bottest\|botui\|botbook\|botmodels\|botplugin\|bottemplates/d' ~/workspace/Cargo.toml
# Build
export PATH="/home/gbuser/.cargo/bin:/home/gbuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH"
export CARGO_TARGET_DIR=~/workspace/target
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy
run: |
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
ssh $SSH system "sudo systemctl stop botserver || true; sleep 2"
scp $SSH ~/workspace/target/debug/botserver system:/tmp/botserver
ssh $SSH system "sudo mv /tmp/botserver /opt/gbo/bin/botserver && sudo chmod +x /opt/gbo/bin/botserver && sudo chown gbuser:gbuser /opt/gbo/bin/botserver && sudo systemctl start botserver"
sleep 5
ssh $SSH system "curl -sf http://localhost:5858/api/health && echo Deployed"
- name: Verify
run: |
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
ssh $SSH system "pgrep -f botserver && echo Running || echo FAIL"