botserver/.forgejo/workflows/botserver.yaml
Rodrigo Rodriguez (Pragmatismo) 8788ad7df2
Some checks failed
GBCI Bundle / build-bundle (push) Failing after 27m36s
GBCI / build (push) Failing after 23m47s
Fix: rename gbserver to botserver, use rustup for Rust install, remove macOS
2025-12-16 19:17:47 -03:00

94 lines
3 KiB
YAML

name: GBCI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: gbo
steps:
- name: Disable SSL verification (temporary)
run: git config --global http.sslVerify false
- uses: actions/checkout@v4
- name: Clone botlib dependency
run: git clone --depth 1 https://github.com/GeneralBots/botlib.git ../botlib
- 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-
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env
rustup target add x86_64-unknown-linux-gnu
rustup target add aarch64-unknown-linux-gnu
rustup target add x86_64-pc-windows-gnu
- 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 .
# Linux x86_64
- name: Build Linux x86_64
run: |
source ~/.cargo/env
cargo build --release --locked --target x86_64-unknown-linux-gnu
# Linux ARM64
- name: Build Linux ARM64
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
source ~/.cargo/env
cargo build --release --locked --target aarch64-unknown-linux-gnu
# Windows x86_64
- name: Build Windows x86_64
env:
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
run: |
source ~/.cargo/env
cargo build --release --locked --target x86_64-pc-windows-gnu
- name: Prepare release artifacts
run: |
sudo mkdir -p /opt/gbo/releases/botserver/{linux,windows}
# Linux
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
# Windows
sudo cp ./target/x86_64-pc-windows-gnu/release/botserver.exe /opt/gbo/releases/botserver/windows/botserver-x86_64.exe || true
sudo chmod -R 755 /opt/gbo/releases/botserver/
- name: Deploy to production and restart
run: |
lxc exec bot:pragmatismo-system -- systemctl stop system
sudo cp ./target/x86_64-unknown-linux-gnu/release/botserver /opt/gbo/bin/system/botserver
sudo chmod +x /opt/gbo/bin/system/botserver
lxc exec bot:pragmatismo-system -- systemctl start system