Move CI workflow to workspace root (Forgejo only detects workflows at repo root)
Some checks failed
BotServer CI / build (push) Failing after 23s
Some checks failed
BotServer CI / build (push) Failing after 23s
This commit is contained in:
parent
b9d6816644
commit
8831c56c90
2 changed files with 115 additions and 1 deletions
114
.forgejo/workflows/botserver.yaml
Normal file
114
.forgejo/workflows/botserver.yaml
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
name: BotServer CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "botserver/**"
|
||||
- "botlib/**"
|
||||
- ".forgejo/workflows/**"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "botserver/**"
|
||||
- "botlib/**"
|
||||
- ".forgejo/workflows/**"
|
||||
|
||||
env:
|
||||
CARGO_BUILD_JOBS: 4
|
||||
CARGO_NET_RETRY: 10
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: gbo
|
||||
|
||||
steps:
|
||||
- name: Disable SSL verification
|
||||
run: git config --global http.sslVerify false
|
||||
|
||||
- name: Checkout BotServer Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: botserver
|
||||
|
||||
- name: Setup Workspace
|
||||
run: |
|
||||
git clone --depth 1 --branch main https://alm.pragmatismo.com.br/GeneralBots/gb.git workspace
|
||||
cd workspace
|
||||
git submodule update --init --depth 1 botlib
|
||||
|
||||
# Remove all members except botserver and botlib from workspace
|
||||
sed -i '/"botapp",/d' Cargo.toml
|
||||
sed -i '/"botdevice",/d' Cargo.toml
|
||||
sed -i '/"bottest",/d' Cargo.toml
|
||||
sed -i '/"botui",/d' Cargo.toml
|
||||
sed -i '/"botbook",/d' Cargo.toml
|
||||
sed -i '/"botmodels",/d' Cargo.toml
|
||||
sed -i '/"botplugin",/d' Cargo.toml
|
||||
sed -i '/"bottemplates",/d' Cargo.toml
|
||||
|
||||
cd ..
|
||||
rm -rf workspace/botserver
|
||||
mv botserver workspace/botserver
|
||||
|
||||
|
||||
|
||||
- name: Cache Cargo registry
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
~/.cache/sccache
|
||||
workspace/target
|
||||
key: ${{ runner.os }}-cargo-v2-debug-server-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-v2-debug-server-
|
||||
${{ runner.os }}-cargo-v2-debug-
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libpq-dev libssl-dev liblzma-dev pkg-config
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install sccache
|
||||
run: |
|
||||
wget https://github.com/mozilla/sccache/releases/download/v0.8.2/sccache-v0.8.2-x86_64-unknown-linux-musl.tar.gz
|
||||
tar xzf sccache-v0.8.2-x86_64-unknown-linux-musl.tar.gz
|
||||
mv sccache-v0.8.2-x86_64-unknown-linux-musl/sccache $HOME/.cargo/bin/sccache
|
||||
chmod +x $HOME/.cargo/bin/sccache
|
||||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
|
||||
$HOME/.cargo/bin/sccache --start-server || true
|
||||
|
||||
|
||||
- name: Setup environment
|
||||
run: sudo cp /opt/gbo/bin/system/.env . 2>/dev/null || true
|
||||
|
||||
- name: Build BotServer
|
||||
working-directory: workspace
|
||||
run: |
|
||||
cargo build -p botserver -j 8 2>&1 | tee /tmp/build.log
|
||||
ls -lh target/debug/botserver
|
||||
sccache --show-stats || true
|
||||
|
||||
- name: Save build log
|
||||
if: always()
|
||||
run: |
|
||||
sudo mkdir -p /opt/gbo/logs
|
||||
sudo cp /tmp/build.log /opt/gbo/logs/botserver-$(date +%Y%m%d-%H%M%S).log || true
|
||||
|
||||
- name: Deploy
|
||||
working-directory: workspace
|
||||
run: |
|
||||
lxc exec bot:pragmatismo-system -- systemctl stop system || true
|
||||
|
||||
sudo cp target/debug/botserver /opt/gbo/bin/system/
|
||||
sudo chmod +x /opt/gbo/bin/system/botserver
|
||||
|
||||
lxc exec bot:pragmatismo-system -- systemctl start system || true
|
||||
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 5d5be5546fa3cd4a7e999fc4a91950677e6c5b2e
|
||||
Subproject commit d4a7d1246b94a7c1543d93f961af926e4412d0e8
|
||||
Loading…
Add table
Reference in a new issue