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:
|
|
|
|
|
CARGO_BUILD_JOBS: 1
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
2025-12-16 17:20:36 -03:00
|
|
|
- name: Clone botlib dependency
|
2025-12-16 22:29:29 -03:00
|
|
|
run: git clone --depth 1 https://github.com/GeneralBots/botlib.git ../botlib
|
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
|
|
|
|
|
target
|
2025-12-18 17:33:04 -03:00
|
|
|
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
2025-12-16 16:35:22 -03:00
|
|
|
restore-keys: |
|
2025-12-18 17:33:04 -03:00
|
|
|
${{ runner.os }}-cargo-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
|
|
|
|
|
|
|
|
- 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
|
2025-12-16 21:13:12 -03:00
|
|
|
run: |
|
2025-12-18 17:33:04 -03:00
|
|
|
cargo build --locked -j 1 2>&1 | tee /tmp/build.log
|
|
|
|
|
ls -lh target/debug/botserver
|
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
|
2025-12-16 13:25:26 -03:00
|
|
|
run: |
|
2025-12-16 20:40:40 -03:00
|
|
|
sudo mkdir -p /opt/gbo/releases/botserver/linux
|
2025-12-18 17:33:04 -03:00
|
|
|
sudo cp target/debug/botserver /opt/gbo/releases/botserver/linux/botserver-x86_64
|
2025-12-18 17:14:36 -03:00
|
|
|
sudo chmod 755 /opt/gbo/releases/botserver/linux/botserver-x86_64
|
2025-12-16 13:25:26 -03:00
|
|
|
|
2025-12-16 22:29:29 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl stop system || true
|
2025-12-18 17:33:04 -03:00
|
|
|
sudo cp target/debug/botserver /opt/gbo/bin/system/botserver
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo chmod +x /opt/gbo/bin/system/botserver
|
2025-12-16 22:29:29 -03:00
|
|
|
lxc exec bot:pragmatismo-system -- systemctl start system || true
|