Fix CI: Combine all steps into single atomic run block
Some checks failed
BotServer CI/CD / build (push) Failing after 10s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-17 18:47:01 -03:00
parent 98dde8cba2
commit 867ba98585

View file

@ -6,74 +6,49 @@ on:
env:
CARGO_BUILD_JOBS: 8
CARGO_NET_RETRY: 10
RUSTC_WRAPPER: sccache
jobs:
build:
runs-on: gbo
steps:
- name: Setup Directories
- name: Clone and Build
run: |
mkdir -p ~/cache/sccache
set -e
# Clean and setup
rm -rf ~/workspace ~/gb-ws
mkdir -p ~/workspace/target
mkdir -p ~/gb-ws
- name: Setup Git
run: |
git config --global http.sslVerify false
git config --global --add safe.directory "*"
- name: Clone Sources (Fresh)
run: |
mkdir -p ~/cache
cd ~/workspace
rm -rf botlib botserver
# Clone fresh
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/botlib.git
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
rm -rf ~/gb-ws
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git ~/gb-ws
- name: Setup Cargo.toml
working-directory: /home/gbuser/workspace
run: |
cp ~/gb-ws/Cargo.toml ~/workspace/Cargo.toml
for m in botapp botdevice bottest botui botbook botmodels botplugin bottemplates; do
grep -v "\"$m\"" ~/workspace/Cargo.toml > /tmp/c.toml && mv /tmp/c.toml ~/workspace/Cargo.toml
done
ls -la ~/workspace/Cargo.toml
- name: Build BotServer
working-directory: /home/gbuser/workspace
run: |
export SCCACHE_DIR=~/cache/sccache
export CARGO_TARGET_DIR=~/workspace/target
export PATH="/home/gbuser/.cargo/bin:/home/gbuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH"
sccache --start-server 2>/dev/null || true
cargo build -p botserver -j 8
sccache --show-stats
# Setup Cargo.toml
cp ~/gb-ws/Cargo.toml ~/workspace/Cargo.toml
sed -i '/botapp\|botdevice\|bottest\|botui\|botbook\|botmodels\|botplugin\|bottemplates/d' ~/workspace/Cargo.toml
# Build
export PATH="/home/gbuser/.cargo/bin:/home/gbuser/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH"
export CARGO_TARGET_DIR=~/workspace/target
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy
run: |
set -e
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
ssh $SSH system "sudo systemctl stop botserver || true; sleep 2"
scp $SSH ~/workspace/target/debug/botserver system:/tmp/botserver
ssh $SSH system "sudo mv /tmp/botserver /opt/gbo/bin/botserver && sudo chmod +x /opt/gbo/bin/botserver && sudo chown gbuser:gbuser /opt/gbo/bin/botserver"
ssh $SSH system "sudo systemctl start botserver"
ssh $SSH system "sudo mv /tmp/botserver /opt/gbo/bin/botserver && sudo chmod +x /opt/gbo/bin/botserver && sudo chown gbuser:gbuser /opt/gbo/bin/botserver && sudo systemctl start botserver"
sleep 5
for i in $(seq 1 30); do
ssh $SSH system "curl -sf http://localhost:5858/api/health" && echo "OK" && break
echo "wait $i/30"
sleep 2
done
ssh $SSH system "curl -sf http://localhost:5858/api/health && echo Deployed"
- name: Verify
run: |
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
ssh $SSH system "pgrep -f botserver && echo 'Running' || echo 'FAIL'"
ssh $SSH system "pgrep -f botserver && echo Running || echo FAIL"