2025-12-16 13:25:26 -03:00
|
|
|
name: GBCI
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
branches: ["main"]
|
|
|
|
|
pull_request:
|
|
|
|
|
branches: ["main"]
|
|
|
|
|
|
2025-12-16 19:59:05 -03:00
|
|
|
env:
|
|
|
|
|
CARGO_HOME: /root/.cargo
|
|
|
|
|
PATH: /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: gbo
|
|
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
- name: Disable SSL verification (temporary)
|
|
|
|
|
run: git config --global http.sslVerify false
|
|
|
|
|
|
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
2025-12-16 17:20:36 -03:00
|
|
|
- name: Clone botlib dependency
|
|
|
|
|
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
|
|
|
|
|
key: ${{ runner.os }}-cargo-botserver-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
restore-keys: |
|
|
|
|
|
${{ runner.os }}-cargo-botserver-
|
|
|
|
|
|
2025-12-16 13:25:26 -03:00
|
|
|
- name: Install Rust
|
2025-12-16 19:17:47 -03:00
|
|
|
run: |
|
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
2025-12-16 19:59:05 -03:00
|
|
|
echo "/root/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
|
/root/.cargo/bin/rustup target add x86_64-unknown-linux-gnu
|
|
|
|
|
/root/.cargo/bin/rustup target add aarch64-unknown-linux-gnu
|
|
|
|
|
/root/.cargo/bin/rustup target add x86_64-pc-windows-gnu
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
- name: Install cross-compilation dependencies
|
|
|
|
|
run: |
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
sudo apt-get install -y \
|
|
|
|
|
gcc-mingw-w64-x86-64 \
|
|
|
|
|
gcc-aarch64-linux-gnu \
|
|
|
|
|
libc6-dev-arm64-cross
|
|
|
|
|
|
|
|
|
|
- name: Setup environment
|
|
|
|
|
run: sudo cp /opt/gbo/bin/system/.env .
|
|
|
|
|
|
|
|
|
|
- name: Build Linux x86_64
|
2025-12-16 19:59:05 -03:00
|
|
|
run: /root/.cargo/bin/cargo build --release --locked --target x86_64-unknown-linux-gnu
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
- name: Build Linux ARM64
|
|
|
|
|
env:
|
|
|
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
2025-12-16 19:59:05 -03:00
|
|
|
run: /root/.cargo/bin/cargo build --release --locked --target aarch64-unknown-linux-gnu
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
- name: Build Windows x86_64
|
|
|
|
|
env:
|
|
|
|
|
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
|
2025-12-16 19:59:05 -03:00
|
|
|
run: /root/.cargo/bin/cargo build --release --locked --target x86_64-pc-windows-gnu
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
- name: Prepare release artifacts
|
|
|
|
|
run: |
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo mkdir -p /opt/gbo/releases/botserver/{linux,windows}
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
# Linux
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo cp ./target/x86_64-unknown-linux-gnu/release/botserver /opt/gbo/releases/botserver/linux/botserver-x86_64 || true
|
|
|
|
|
sudo cp ./target/aarch64-unknown-linux-gnu/release/botserver /opt/gbo/releases/botserver/linux/botserver-aarch64 || true
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
# Windows
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo cp ./target/x86_64-pc-windows-gnu/release/botserver.exe /opt/gbo/releases/botserver/windows/botserver-x86_64.exe || true
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
sudo chmod -R 755 /opt/gbo/releases/botserver/
|
|
|
|
|
|
|
|
|
|
- name: Deploy to production and restart
|
|
|
|
|
run: |
|
|
|
|
|
lxc exec bot:pragmatismo-system -- systemctl stop system
|
|
|
|
|
|
2025-12-16 19:17:47 -03:00
|
|
|
sudo cp ./target/x86_64-unknown-linux-gnu/release/botserver /opt/gbo/bin/system/botserver
|
|
|
|
|
sudo chmod +x /opt/gbo/bin/system/botserver
|
2025-12-16 13:25:26 -03:00
|
|
|
|
|
|
|
|
lxc exec bot:pragmatismo-system -- systemctl start system
|