botui/.forgejo/workflows/botui.yaml

79 lines
3.1 KiB
YAML
Raw Normal View History

name: BotUI CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_BUILD_JOBS: 6
CARGO_NET_RETRY: 10
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs:
build:
runs-on: gbo
steps:
- name: Setup Git
2026-03-31 12:55:33 -03:00
run: |
git config --global http.sslVerify false
git config --global --add safe.directory "*"
- name: Setup Workspace
run: |
mkdir -p /opt/gbo/ci/botui
# Clone the main gb repository
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git /opt/gbo/ci/botui/workspace
cd /opt/gbo/ci/botui/workspace
git submodule update --init --depth 1 botlib
# Clone botui separately
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botui.git botui
# Remove all members except botui and botlib from workspace
sed -i '/"botapp",/d' Cargo.toml
sed -i '/"botdevice",/d' Cargo.toml
sed -i '/"bottest",/d' Cargo.toml
sed -i '/"botserver",/d' Cargo.toml
sed -i '/"botbook",/d' Cargo.toml
sed -i '/"botmodels",/d' Cargo.toml
sed -i '/"botplugin",/d' Cargo.toml
sed -i '/"bottemplates",/d' Cargo.toml
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libssl-dev liblzma-dev pkg-config
2025-12-16 16:35:22 -03:00
- name: Setup environment
run: sudo cp /opt/gbo/bin/system/.env . 2>/dev/null || true
- name: Build BotUI
working-directory: /opt/gbo/ci/botui/workspace
run: |
cargo build --release -p botui --features embed-ui -j 8 2>&1 | tee /tmp/build.log
ls -lh target/release/botui
- name: Save build log
if: always()
run: |
sudo mkdir -p /opt/gbo/logs
sudo cp /tmp/build.log /opt/gbo/logs/botui-$(date +%Y%m%d-%H%M%S).log || true
- name: Setup incus on host
run: |
# SSH to host and setup incus for pushing to containers
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo cp /opt/incus/bin/incus /usr/local/bin/ && sudo chmod +x /usr/local/bin/incus"
- name: Deploy via incus from host
run: |
# SSH to host and deploy via incus
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo incus exec system -- pkill -f /opt/gbo/bin/botui || true"
sleep 2
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo incus exec system -- rm -f /opt/gbo/bin/botui"
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo incus file push /opt/gbo/ci/botui/workspace/target/release/botui system/opt/gbo/bin/botui"
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo incus exec system -- chmod +x /opt/gbo/bin/botui"
ssh -o StrictHostKeyChecking=no administrator@63.141.255.9 "sudo incus exec system -- su - gbuser -c 'cd /opt/gbo/bin && nohup ./botui --noconsole >> /opt/gbo/logs/botui.log 2>&1 &'"