CI: Single workflow at root
This commit is contained in:
parent
a413cbd37e
commit
bccd7a24cf
2 changed files with 4 additions and 67 deletions
|
|
@ -1,50 +0,0 @@
|
||||||
# v26 - Clean submodule state
|
|
||||||
name: BotServer CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
env:
|
|
||||||
SCCACHE_DIR: /opt/gbo/work/.sccache
|
|
||||||
CARGO_TARGET_DIR: /opt/gbo/work/target
|
|
||||||
RUSTC_WRAPPER: sccache
|
|
||||||
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: gbo
|
|
||||||
steps:
|
|
||||||
- name: Setup
|
|
||||||
run: |
|
|
||||||
cd /opt/gbo/work/botserver
|
|
||||||
git rebase --abort 2>/dev/null || true
|
|
||||||
git reset --hard HEAD
|
|
||||||
git clean -fd
|
|
||||||
git pull
|
|
||||||
# CRITICAL: Reset submodules to clean state
|
|
||||||
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
|
|
||||||
git submodule foreach --recursive git clean -fd 2>/dev/null || true
|
|
||||||
git submodule update --init --recursive botlib botserver
|
|
||||||
# Verify clean
|
|
||||||
echo "Submodule status:"
|
|
||||||
git submodule status | head -5
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd /opt/gbo/work/botserver
|
|
||||||
cargo build -p botserver
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
run: |
|
|
||||||
echo "1. Kill old..."
|
|
||||||
timeout 5 bash -c 'while pgrep -x botserver > /dev/null; do pkill -x botserver; sleep 0.5; done' || true
|
|
||||||
echo "2. Copy..."
|
|
||||||
mkdir -p /opt/gbo/bin
|
|
||||||
cp -f /opt/gbo/work/botserver/target/debug/botserver /opt/gbo/bin/
|
|
||||||
chmod +x /opt/gbo/bin/botserver
|
|
||||||
echo "3. Start..."
|
|
||||||
cd /opt/gbo/bin && ./botserver --noconsole &
|
|
||||||
sleep 3
|
|
||||||
echo "4. Verify..."
|
|
||||||
pgrep -x botserver && echo "✅ Running" || echo "❌ Failed"
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
name: BotServer CI
|
name: BotServer CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: gbo
|
runs-on: gbo
|
||||||
|
|
@ -15,30 +12,20 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd /opt/gbo/work/botserver
|
cd /opt/gbo/work/botserver
|
||||||
git rebase --abort 2>/dev/null || true
|
git rebase --abort 2>/dev/null || true
|
||||||
git reset --hard HEAD && git clean -fd
|
git reset --hard HEAD && git clean -fd && git pull
|
||||||
git pull
|
|
||||||
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
|
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
|
||||||
git submodule update --init --recursive botlib botserver 2>/dev/null || true
|
git submodule update --init --recursive botlib botserver 2>/dev/null || true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cd /opt/gbo/work/botserver
|
cd /opt/gbo/work/botserver
|
||||||
cargo build -p botserver
|
cargo build -p botserver
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
|
B="/opt/gbo/work/botserver/target/debug/botserver"
|
||||||
echo "1. Stop old on system..."
|
|
||||||
sudo incus exec system -- systemctl stop botserver || true
|
sudo incus exec system -- systemctl stop botserver || true
|
||||||
sudo incus exec system -- pkill -x botserver || true
|
sudo incus exec system -- pkill -x botserver || true
|
||||||
sleep 1
|
sleep 1
|
||||||
|
sudo incus file push "$B" system:/opt/gbo/bin/botserver --mode=0755
|
||||||
echo "2. Copy new binary..."
|
|
||||||
sudo incus file push "$BINARY" system:/opt/gbo/bin/botserver --mode=0755
|
|
||||||
|
|
||||||
echo "3. Start new on system..."
|
|
||||||
sudo incus exec system -- systemctl start botserver
|
sudo incus exec system -- systemctl start botserver
|
||||||
sleep 2
|
sleep 2
|
||||||
|
sudo incus exec system -- pgrep -x botserver && echo "✅ Deployed!" || echo "❌ Failed"
|
||||||
echo "4. Verify..."
|
|
||||||
sudo incus exec system -- pgrep -x botserver && echo "✅ SUCCESS" || echo "❌ FAILED"
|
|
||||||
Loading…
Add table
Reference in a new issue