Fix CI: Combine all steps into single atomic run block
Some checks failed
BotServer CI/CD / build (push) Failing after 10s
Some checks failed
BotServer CI/CD / build (push) Failing after 10s
This commit is contained in:
parent
98dde8cba2
commit
867ba98585
1 changed files with 21 additions and 46 deletions
|
|
@ -6,74 +6,49 @@ on:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_BUILD_JOBS: 8
|
CARGO_BUILD_JOBS: 8
|
||||||
CARGO_NET_RETRY: 10
|
|
||||||
RUSTC_WRAPPER: sccache
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: gbo
|
runs-on: gbo
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Directories
|
- name: Clone and Build
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/cache/sccache
|
set -e
|
||||||
|
|
||||||
|
# Clean and setup
|
||||||
|
rm -rf ~/workspace ~/gb-ws
|
||||||
mkdir -p ~/workspace/target
|
mkdir -p ~/workspace/target
|
||||||
mkdir -p ~/gb-ws
|
mkdir -p ~/cache
|
||||||
|
|
||||||
- name: Setup Git
|
|
||||||
run: |
|
|
||||||
git config --global http.sslVerify false
|
|
||||||
git config --global --add safe.directory "*"
|
|
||||||
|
|
||||||
- name: Clone Sources (Fresh)
|
|
||||||
run: |
|
|
||||||
cd ~/workspace
|
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/botlib.git
|
||||||
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/BotServer.git botserver
|
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
|
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git ~/gb-ws
|
||||||
|
|
||||||
- name: Setup Cargo.toml
|
# Setup Cargo.toml
|
||||||
working-directory: /home/gbuser/workspace
|
|
||||||
run: |
|
|
||||||
cp ~/gb-ws/Cargo.toml ~/workspace/Cargo.toml
|
cp ~/gb-ws/Cargo.toml ~/workspace/Cargo.toml
|
||||||
for m in botapp botdevice bottest botui botbook botmodels botplugin bottemplates; do
|
sed -i '/botapp\|botdevice\|bottest\|botui\|botbook\|botmodels\|botplugin\|bottemplates/d' ~/workspace/Cargo.toml
|
||||||
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
|
# Build
|
||||||
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"
|
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
|
||||||
|
|
||||||
sccache --start-server 2>/dev/null || true
|
|
||||||
cargo build -p botserver -j 8
|
|
||||||
sccache --show-stats
|
|
||||||
ls -lh target/debug/botserver
|
ls -lh target/debug/botserver
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
set -e
|
|
||||||
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
|
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
ssh $SSH system "sudo systemctl stop botserver || true; sleep 2"
|
ssh $SSH system "sudo systemctl stop botserver || true; sleep 2"
|
||||||
scp $SSH ~/workspace/target/debug/botserver system:/tmp/botserver
|
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 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"
|
||||||
ssh $SSH system "sudo systemctl start botserver"
|
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
for i in $(seq 1 30); do
|
ssh $SSH system "curl -sf http://localhost:5858/api/health && echo Deployed"
|
||||||
ssh $SSH system "curl -sf http://localhost:5858/api/health" && echo "OK" && break
|
|
||||||
echo "wait $i/30"
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
- name: Verify
|
- name: Verify
|
||||||
run: |
|
run: |
|
||||||
SSH="-i /home/gbuser/.ssh/id_ed25519 -o StrictHostKeyChecking=no"
|
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"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue