Completo: Rust setup + Clone + Build + Deploy (v11)
Some checks failed
BotServer CI/CD / build (push) Has been cancelled

Mudanças:
- Adiciona setup completo do Rust (rustup, cargo, rustc)
- Instala sccache para cache de build
- Configura PATH e variáveis de ambiente
- Clone limpo do workspace
- Inicializa submodules botserver e botlib
- Build com sccache
- Deploy automático no system container
- Cleanup após build

Fluxo completo:
1. Setup Rust (instala se necessário)
2. Clone limpo do repositório gb
3. Inicializa submodules
4. cargo build -p botserver
5. Deploy via SSH
6. Cleanup

Tempo estimado: ~4-5 minutos
- Setup Rust: ~30s (se instalar)
- Clone: ~30s
- Submodules: ~15s
- Build: ~2-3min (com cache)
- Deploy: ~30s
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-18 17:41:53 -03:00
parent 7f4774a88a
commit 7115cb3e19

View file

@ -1,5 +1,5 @@
# HASH-BUSTER-20260418-SIMPLIFICADO-v10 # HASH-BUSTER-20260418-COMPLETO-v11
# SIMPLIFICADO: Clone limpo sempre, sem dependência de estado anterior # COMPLETO: Rust setup + Clone limpo + Build + Deploy
name: BotServer CI/CD name: BotServer CI/CD
on: on:
@ -11,14 +11,52 @@ on:
env: env:
SCCACHE_DIR: /opt/gbo/work/.sccache SCCACHE_DIR: /opt/gbo/work/.sccache
CARGO_TARGET_DIR: /opt/gbo/work/target CARGO_TARGET_DIR: /opt/gbo/work/target
RUSTUP_HOME: /opt/gbo/work/.rustup
CARGO_HOME: /opt/gbo/work/.cargo
jobs: jobs:
build: build:
runs-on: gbo runs-on: gbo
steps: steps:
- name: Setup Rust
run: |
echo "=== Setup do Rust ==="
export RUSTUP_HOME=/opt/gbo/work/.rustup
export CARGO_HOME=/opt/gbo/work/.cargo
export PATH="/opt/gbo/work/.cargo/bin:$PATH"
# Verificar se Rust já está instalado
if [ ! -f /opt/gbo/work/.cargo/bin/cargo ]; then
echo "Instalando Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "Rust instalado!"
else
echo "Rust já está instalado"
fi
# Atualizar rustup
rustup update stable || true
# Instalar sccache
echo "Instalando sccache..."
cargo install sccache || true
# Configurar ambiente
echo "export PATH=/opt/gbo/work/.cargo/bin:\$PATH" >> /home/gbuser/.bashrc
echo "export RUSTUP_HOME=/opt/gbo/work/.rustup" >> /home/gbuser/.bashrc
echo "export CARGO_HOME=/opt/gbo/work/.cargo" >> /home/gbuser/.bashrc
# Iniciar sccache
sccache --start-server || true
echo "Setup do Rust concluído!"
cargo --version
rustc --version
- name: Clone Limpo - name: Clone Limpo
run: | run: |
echo "=== Clone Limpo do Workspace ===" echo "=== Clone Limpo do Workspace ==="
export PATH="/opt/gbo/work/.cargo/bin:$PATH"
# Limpar diretório de trabalho anterior # Limpar diretório de trabalho anterior
rm -rf /opt/gbo/work/build rm -rf /opt/gbo/work/build
@ -55,6 +93,9 @@ jobs:
- name: Build - name: Build
run: | run: |
echo "=== Build (Debug) ===" echo "=== Build (Debug) ==="
export PATH="/opt/gbo/work/.cargo/bin:$PATH"
export RUSTUP_HOME=/opt/gbo/work/.rustup
export CARGO_HOME=/opt/gbo/work/.cargo
cd /opt/gbo/work/build/workspace cd /opt/gbo/work/build/workspace
# Verificar estrutura # Verificar estrutura
@ -68,11 +109,13 @@ jobs:
exit 1 exit 1
fi fi
# Build # Build com sccache
cargo build -p botserver echo "Iniciando build com sccache..."
RUSTC_WRAPPER=sccache cargo build -p botserver
echo "Build concluído!" echo "Build concluído!"
ls -lh target/debug/botserver ls -lh target/debug/botserver
sccache --show-stats
- name: Deploy - name: Deploy
run: | run: |