Create dedicated BotUI CI workflow

- New workflow for botui-only builds and deployments
- Trigger only on botui/**, botlib/** changes
- Build only botui package with embed-ui feature
- Deploy only botui binary
- Restart only ui service
- Separate cache key to avoid conflicts with botserver
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-02-05 08:45:20 -03:00
parent 91a750127c
commit e0504f3703

View file

@ -1,23 +1,56 @@
name: GBCI name: BotUI CI
on: on:
push: push:
branches: ["main"] branches: ["main"]
paths:
- "botui/**"
- "botlib/**"
- ".github/workflows/botui.yaml"
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths:
- "botui/**"
- "botlib/**"
- ".github/workflows/botui.yaml"
env:
CARGO_BUILD_JOBS: 8
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
jobs: jobs:
build: build:
runs-on: gbo runs-on: gbo
steps: steps:
- name: Disable SSL verification (temporary) - name: Disable SSL verification
run: git config --global http.sslVerify false run: git config --global http.sslVerify false
- uses: actions/checkout@v4 - name: Checkout BotUI Code
uses: actions/checkout@v4
with:
path: botui
- name: Clone botlib dependency - name: Setup Workspace
run: git clone --depth 1 https://github.com/GeneralBots/botlib.git ../botlib run: |
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git workspace
cd workspace
git submodule update --init --depth 1 botlib
# 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
cd ..
rm -rf workspace/botui
mv botui workspace/botui
- name: Cache Cargo registry - name: Cache Cargo registry
uses: actions/cache@v4 uses: actions/cache@v4
@ -25,34 +58,54 @@ jobs:
path: | path: |
~/.cargo/registry ~/.cargo/registry
~/.cargo/git ~/.cargo/git
target ~/.cache/sccache
key: ${{ runner.os }}-cargo-botui-${{ hashFiles('**/Cargo.lock') }} workspace/target
key: ${{ runner.os }}-cargo-v2-debug-ui-${{ hashFiles('**/Cargo.lock') }}
restore-keys: | restore-keys: |
${{ runner.os }}-cargo-botui- ${{ runner.os }}-cargo-v2-debug-ui-
${{ runner.os }}-cargo-v2-debug-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev libssl-dev liblzma-dev pkg-config
- name: Install Rust - name: Install Rust
run: | run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
echo "/root/.cargo/bin" >> $GITHUB_PATH echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Install sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-x86_64-unknown-linux-musl.tar.gz
tar xzf sccache-v0.8.2-x86_64-unknown-linux-musl.tar.gz
mv sccache-v0.8.2-x86_64-unknown-linux-musl/sccache $HOME/.cargo/bin/sccache
chmod +x $HOME/.cargo/bin/sccache
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
$HOME/.cargo/bin/sccache --start-server || true
- name: Setup environment - name: Setup environment
run: sudo cp /opt/gbo/bin/system/.env . 2>/dev/null || true
- name: Build BotUI
working-directory: workspace
run: | run: |
sudo cp /opt/gbo/bin/system/botui.env .env cargo build -p botui --features embed-ui -j 8 2>&1 | tee /tmp/build.log
ls -lh target/debug/botui
sccache --show-stats || true
- name: Build Linux x86_64 - name: Save build log
run: /root/.cargo/bin/cargo build --locked --release if: always()
- name: Prepare release artifacts
run: | run: |
sudo mkdir -p /opt/gbo/releases/botui/linux-x86_64 sudo mkdir -p /opt/gbo/logs
sudo cp ./target/release/botui /opt/gbo/releases/botui/linux-x86_64/ || true sudo cp /tmp/build.log /opt/gbo/logs/botui-$(date +%Y%m%d-%H%M%S).log || true
sudo chmod -R 755 /opt/gbo/releases/botui/
- name: Deploy and restart local service - name: Deploy
working-directory: workspace
run: | run: |
lxc exec bot:pragmatismo-system -- systemctl stop botui lxc exec bot:pragmatismo-system -- systemctl stop ui || true
sudo cp ./target/release/botui /opt/gbo/bin/botui sudo cp target/debug/botui /opt/gbo/bin/system/
sudo chmod +x /opt/gbo/bin/botui sudo chmod +x /opt/gbo/bin/system/botui
lxc exec bot:pragmatismo-system -- systemctl start botui lxc exec bot:pragmatismo-system -- systemctl start ui || true