2025-12-16 13:25:26 -03:00
|
|
|
name: GBCI
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: ["main"]
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: ["main"]
|
|
|
|
|
|
2025-12-17 21:56:28 -03:00
|
|
|
env:
|
2026-01-25 20:17:08 -03:00
|
|
|
CARGO_BUILD_JOBS: 8
|
2025-12-17 21:56:28 -03:00
|
|
|
CARGO_INCREMENTAL: 0
|
2025-12-18 17:14:36 -03:00
|
|
|
CARGO_NET_RETRY: 10
|
2025-12-17 21:56:28 -03:00
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: gbo
|
|
|
|
|
|
|
|
|
|
steps:
|
2025-12-18 17:14:36 -03:00
|
|
|
- name: Disable SSL verification
|
2025-12-16 13:25:26 -03:00
|
|
|
run: git config --global http.sslVerify false
|
|
|
|
|
|
2026-01-25 12:27:50 -03:00
|
|
|
- name: Checkout BotServer Code
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
with:
|
|
|
|
|
path: botserver
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2026-01-25 12:27:50 -03:00
|
|
|
- name: Setup Workspace
|
|
|
|
|
run: |
|
2026-01-25 21:27:16 -03:00
|
|
|
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git workspace
|
2026-01-25 14:11:28 -03:00
|
|
|
cd workspace
|
|
|
|
|
git submodule update --init --depth 1 botlib
|
2026-01-25 17:01:02 -03:00
|
|
|
git submodule update --init --depth 1 botui
|
2026-01-25 18:01:19 -03:00
|
|
|
|
2026-01-25 17:02:57 -03:00
|
|
|
|
2026-01-25 14:18:24 -03:00
|
|
|
# Remove missing members from workspace to prevent Cargo errors
|
|
|
|
|
sed -i '/"botapp",/d' Cargo.toml
|
|
|
|
|
sed -i '/"botdevice",/d' Cargo.toml
|
|
|
|
|
sed -i '/"bottest",/d' Cargo.toml
|
2026-01-25 14:11:28 -03:00
|
|
|
cd ..
|
2026-01-25 12:27:50 -03:00
|
|
|
rm -rf workspace/botserver
|
|
|
|
|
mv botserver workspace/botserver
|
2026-01-25 18:01:19 -03:00
|
|
|
|
2026-01-25 17:02:57 -03:00
|
|
|
|
2025-12-16 17:00:14 -03:00
|
|
|
|
2025-12-16 16:35:22 -03:00
|
|
|
- name: Cache Cargo registry
|
|
|
|
|
uses: actions/cache@v4
|
|
|
|
|
with:
|
|
|
|
|
path: |
|
|
|
|
|
~/.cargo/registry
|
|
|
|
|
~/.cargo/git
|
2026-01-25 22:58:35 -03:00
|
|
|
~/.cache/sccache
|
2026-01-25 12:27:50 -03:00
|
|
|
workspace/target
|
2026-01-25 14:10:17 -03:00
|
|
|
key: ${{ runner.os }}-cargo-v2-debug-${{ hashFiles('**/Cargo.lock') }}
|
2025-12-16 16:35:22 -03:00
|
|
|
restore-keys: |
|
2026-01-25 14:10:17 -03:00
|
|
|
${{ runner.os }}-cargo-v2-debug-
|
2025-12-18 14:08:47 -03:00
|
|
|
|
2025-12-17 22:40:45 -03:00
|
|
|
- name: Install system dependencies
|
|
|
|
|
run: |
|
|
|
|
|
sudo apt-get update
|
2025-12-18 17:14:36 -03:00
|
|
|
sudo apt-get install -y libpq-dev libssl-dev liblzma-dev pkg-config
|
2025-12-17 22:40:45 -03:00
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
- name: Install Rust
|
2025-12-16 19:17:47 -03:00
|
|
|
run: |
|
2025-12-18 17:14:36 -03:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
|
|
|
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2026-01-25 18:01:19 -03:00
|
|
|
- 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
|
2026-01-25 18:59:25 -03:00
|
|
|
$HOME/.cargo/bin/sccache --start-server || true
|
2026-01-25 18:01:19 -03:00
|
|
|
|
|
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
- name: Setup environment
|
2025-12-18 17:14:36 -03:00
|
|
|
run: sudo cp /opt/gbo/bin/system/.env . 2>/dev/null || true
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2025-12-18 17:33:04 -03:00
|
|
|
- name: Build debug
|
2026-01-25 12:27:50 -03:00
|
|
|
working-directory: workspace
|
2025-12-16 21:13:12 -03:00
|
|
|
run: |
|
2026-01-26 12:04:03 -03:00
|
|
|
cargo build -p botserver -j 8 2>&1 | tee /tmp/build.log
|
|
|
|
|
cargo build -p botui --features embed-ui -j 8 2>&1 | tee -a /tmp/build.log
|
2025-12-18 17:33:04 -03:00
|
|
|
ls -lh target/debug/botserver
|
2026-01-25 16:55:08 -03:00
|
|
|
ls -lh target/debug/botui
|
2026-01-25 18:59:25 -03:00
|
|
|
sccache --show-stats || true
|
2025-12-16 22:29:29 -03:00
|
|
|
|
|
|
|
|
- name: Save build log
|
|
|
|
|
if: always()
|
|
|
|
|
run: |
|
|
|
|
|
sudo mkdir -p /opt/gbo/logs
|
2025-12-18 17:14:36 -03:00
|
|
|
sudo cp /tmp/build.log /opt/gbo/logs/botserver-$(date +%Y%m%d-%H%M%S).log || true
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2025-12-18 17:14:36 -03:00
|
|
|
- name: Deploy
|
2026-01-25 12:27:50 -03:00
|
|
|
working-directory: workspace
|
2025-12-16 13:25:26 -03:00
|
|
|
run: |
|
2025-12-16 22:29:29 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl stop system || true
|
2026-01-25 22:51:21 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl stop ui || true
|
2026-01-25 16:55:08 -03:00
|
|
|
|
|
|
|
|
sudo cp target/debug/botserver /opt/gbo/bin/system/
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo chmod +x /opt/gbo/bin/system/botserver
|
2026-01-25 16:55:08 -03:00
|
|
|
sudo cp target/debug/botui /opt/gbo/bin/system/
|
|
|
|
|
sudo chmod +x /opt/gbo/bin/system/botui
|
|
|
|
|
|
2025-12-16 22:29:29 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl start system || true
|
2026-01-25 22:51:21 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl start ui || true
|