Add Forgejo CI workflows - botserver.yaml and botserver-bundle.yaml with cross-platform builds
This commit is contained in:
parent
e486689644
commit
d380368fee
3 changed files with 344 additions and 36 deletions
254
.forgejo/workflows/botserver-bundle.yaml
Normal file
254
.forgejo/workflows/botserver-bundle.yaml
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
name: GBCI Bundle
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-bundle:
|
||||
runs-on: gbo
|
||||
|
||||
steps:
|
||||
- name: Disable SSL verification (temporary)
|
||||
run: git config --global http.sslVerify false
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: msrd0/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: >-
|
||||
x86_64-unknown-linux-gnu,
|
||||
aarch64-unknown-linux-gnu,
|
||||
x86_64-pc-windows-gnu,
|
||||
x86_64-apple-darwin,
|
||||
aarch64-apple-darwin
|
||||
|
||||
- name: Install cross-compilation dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc-mingw-w64-x86-64 \
|
||||
gcc-aarch64-linux-gnu \
|
||||
libc6-dev-arm64-cross \
|
||||
zip
|
||||
|
||||
- name: Setup environment
|
||||
run: sudo cp /opt/gbo/bin/system/.env .
|
||||
|
||||
# ============================================
|
||||
# Download Python portable distributions
|
||||
# ============================================
|
||||
- name: Download Python portables
|
||||
run: |
|
||||
PYTHON_VERSION="3.12.7"
|
||||
mkdir -p python-installers
|
||||
|
||||
# Linux x86_64 - python-build-standalone
|
||||
curl -L -o python-installers/python-${PYTHON_VERSION}-linux-x86_64.tar.gz \
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-unknown-linux-gnu-install_only.tar.gz"
|
||||
|
||||
# Linux ARM64 - python-build-standalone
|
||||
curl -L -o python-installers/python-${PYTHON_VERSION}-linux-arm64.tar.gz \
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-aarch64-unknown-linux-gnu-install_only.tar.gz"
|
||||
|
||||
# Windows x86_64 - python-build-standalone
|
||||
curl -L -o python-installers/python-${PYTHON_VERSION}-windows-x86_64.tar.gz \
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-pc-windows-msvc-install_only.tar.gz"
|
||||
|
||||
# macOS x86_64 - python-build-standalone
|
||||
curl -L -o python-installers/python-${PYTHON_VERSION}-macos-x86_64.tar.gz \
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-apple-darwin-install_only.tar.gz"
|
||||
|
||||
# macOS ARM64 - python-build-standalone
|
||||
curl -L -o python-installers/python-${PYTHON_VERSION}-macos-arm64.tar.gz \
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-aarch64-apple-darwin-install_only.tar.gz"
|
||||
|
||||
ls -la python-installers/
|
||||
|
||||
# ============================================
|
||||
# Build botserver for all platforms
|
||||
# ============================================
|
||||
- name: Build botserver - Linux x86_64
|
||||
run: cargo build --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Build botserver - Linux ARM64
|
||||
env:
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: cargo build --release --locked --target aarch64-unknown-linux-gnu
|
||||
|
||||
- name: Build botserver - Windows x86_64
|
||||
env:
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
|
||||
run: cargo build --release --locked --target x86_64-pc-windows-gnu
|
||||
|
||||
- name: Build botserver - macOS x86_64
|
||||
run: cargo build --release --locked --target x86_64-apple-darwin || echo "macOS x86_64 requires osxcross"
|
||||
|
||||
- name: Build botserver - macOS ARM64
|
||||
run: cargo build --release --locked --target aarch64-apple-darwin || echo "macOS ARM64 requires osxcross"
|
||||
|
||||
# ============================================
|
||||
# Build botui for all platforms
|
||||
# ============================================
|
||||
- name: Build botui - Linux x86_64
|
||||
run: |
|
||||
cd ../botui
|
||||
cargo build --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: Build botui - Linux ARM64
|
||||
env:
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: |
|
||||
cd ../botui
|
||||
cargo build --release --locked --target aarch64-unknown-linux-gnu
|
||||
|
||||
- name: Build botui - Windows x86_64
|
||||
env:
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
|
||||
run: |
|
||||
cd ../botui
|
||||
cargo build --release --locked --target x86_64-pc-windows-gnu
|
||||
|
||||
- name: Build botui - macOS x86_64
|
||||
run: |
|
||||
cd ../botui
|
||||
cargo build --release --locked --target x86_64-apple-darwin || echo "macOS x86_64 requires osxcross"
|
||||
|
||||
- name: Build botui - macOS ARM64
|
||||
run: |
|
||||
cd ../botui
|
||||
cargo build --release --locked --target aarch64-apple-darwin || echo "macOS ARM64 requires osxcross"
|
||||
|
||||
# ============================================
|
||||
# Build botbook documentation
|
||||
# ============================================
|
||||
- name: Install mdBook
|
||||
run: |
|
||||
if ! command -v mdbook &> /dev/null; then
|
||||
cargo install mdbook
|
||||
fi
|
||||
|
||||
- name: Build botbook
|
||||
run: |
|
||||
cd ../botbook
|
||||
mdbook build
|
||||
|
||||
# ============================================
|
||||
# Create bundle directories
|
||||
# Structure:
|
||||
# botserver(.exe) <- root binary
|
||||
# botserver-components/
|
||||
# botui(.exe)
|
||||
# botmodels/
|
||||
# botbook/
|
||||
# botserver-installers/
|
||||
# python-<version>-<platform>.tar.gz
|
||||
# postgresql, valkey, vault, minio, zitadel, llama, models...
|
||||
# ============================================
|
||||
- name: Create bundle structure
|
||||
run: |
|
||||
BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
|
||||
PYTHON_VERSION="3.12.7"
|
||||
|
||||
# Linux x86_64 bundle
|
||||
mkdir -p bundle/linux-x86_64/botserver-components
|
||||
mkdir -p bundle/linux-x86_64/botserver-installers
|
||||
cp ./target/x86_64-unknown-linux-gnu/release/gbserver bundle/linux-x86_64/botserver || true
|
||||
cp ../botui/target/x86_64-unknown-linux-gnu/release/botui bundle/linux-x86_64/botserver-components/ || true
|
||||
cp python-installers/python-${PYTHON_VERSION}-linux-x86_64.tar.gz bundle/linux-x86_64/botserver-installers/
|
||||
|
||||
# Linux ARM64 bundle
|
||||
mkdir -p bundle/linux-arm64/botserver-components
|
||||
mkdir -p bundle/linux-arm64/botserver-installers
|
||||
cp ./target/aarch64-unknown-linux-gnu/release/gbserver bundle/linux-arm64/botserver || true
|
||||
cp ../botui/target/aarch64-unknown-linux-gnu/release/botui bundle/linux-arm64/botserver-components/ || true
|
||||
cp python-installers/python-${PYTHON_VERSION}-linux-arm64.tar.gz bundle/linux-arm64/botserver-installers/
|
||||
|
||||
# Windows x86_64 bundle
|
||||
mkdir -p bundle/windows-x86_64/botserver-components
|
||||
mkdir -p bundle/windows-x86_64/botserver-installers
|
||||
cp ./target/x86_64-pc-windows-gnu/release/gbserver.exe bundle/windows-x86_64/botserver.exe || true
|
||||
cp ../botui/target/x86_64-pc-windows-gnu/release/botui.exe bundle/windows-x86_64/botserver-components/ || true
|
||||
cp python-installers/python-${PYTHON_VERSION}-windows-x86_64.tar.gz bundle/windows-x86_64/botserver-installers/
|
||||
|
||||
# macOS x86_64 bundle
|
||||
mkdir -p bundle/macos-x86_64/botserver-components
|
||||
mkdir -p bundle/macos-x86_64/botserver-installers
|
||||
cp ./target/x86_64-apple-darwin/release/gbserver bundle/macos-x86_64/botserver || true
|
||||
cp ../botui/target/x86_64-apple-darwin/release/botui bundle/macos-x86_64/botserver-components/ || true
|
||||
cp python-installers/python-${PYTHON_VERSION}-macos-x86_64.tar.gz bundle/macos-x86_64/botserver-installers/
|
||||
|
||||
# macOS ARM64 bundle
|
||||
mkdir -p bundle/macos-arm64/botserver-components
|
||||
mkdir -p bundle/macos-arm64/botserver-installers
|
||||
cp ./target/aarch64-apple-darwin/release/gbserver bundle/macos-arm64/botserver || true
|
||||
cp ../botui/target/aarch64-apple-darwin/release/botui bundle/macos-arm64/botserver-components/ || true
|
||||
cp python-installers/python-${PYTHON_VERSION}-macos-arm64.tar.gz bundle/macos-arm64/botserver-installers/
|
||||
|
||||
# ============================================
|
||||
# Copy shared components to all bundles
|
||||
# ============================================
|
||||
- name: Copy botmodels to bundles
|
||||
run: |
|
||||
for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do
|
||||
mkdir -p bundle/$platform/botserver-components/botmodels
|
||||
cp -r ../botmodels/* bundle/$platform/botserver-components/botmodels/
|
||||
done
|
||||
|
||||
- name: Copy botbook to bundles
|
||||
run: |
|
||||
for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do
|
||||
mkdir -p bundle/$platform/botserver-components/botbook
|
||||
cp -r ../botbook/book/* bundle/$platform/botserver-components/botbook/
|
||||
done
|
||||
|
||||
- name: Copy installers to bundles
|
||||
run: |
|
||||
for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do
|
||||
cp -r ./botserver-installers/* bundle/$platform/botserver-installers/
|
||||
done
|
||||
|
||||
# ============================================
|
||||
# Create ZIP archives
|
||||
# ============================================
|
||||
- name: Create release archives
|
||||
run: |
|
||||
BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
|
||||
|
||||
cd bundle
|
||||
for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do
|
||||
if [ -f "$platform/botserver" ] || [ -f "$platform/botserver.exe" ]; then
|
||||
zip -r "botserver-bundle-${BUNDLE_VERSION}-${platform}.zip" "$platform"
|
||||
echo "Created: botserver-bundle-${BUNDLE_VERSION}-${platform}.zip"
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
|
||||
# ============================================
|
||||
# Deploy bundles
|
||||
# ============================================
|
||||
- name: Deploy bundle releases
|
||||
run: |
|
||||
BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
|
||||
|
||||
sudo mkdir -p /opt/gbo/releases/botserver-bundle
|
||||
sudo cp bundle/*.zip /opt/gbo/releases/botserver-bundle/ || true
|
||||
|
||||
# Also keep unpacked bundles for direct access
|
||||
sudo mkdir -p /opt/gbo/releases/botserver-bundle/unpacked
|
||||
sudo cp -r bundle/linux-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true
|
||||
sudo cp -r bundle/linux-arm64 /opt/gbo/releases/botserver-bundle/unpacked/ || true
|
||||
sudo cp -r bundle/windows-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true
|
||||
sudo cp -r bundle/macos-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true
|
||||
sudo cp -r bundle/macos-arm64 /opt/gbo/releases/botserver-bundle/unpacked/ || true
|
||||
|
||||
sudo chmod -R 755 /opt/gbo/releases/botserver-bundle/
|
||||
|
||||
echo "Bundle releases deployed to /opt/gbo/releases/botserver-bundle/"
|
||||
ls -la /opt/gbo/releases/botserver-bundle/
|
||||
90
.forgejo/workflows/botserver.yaml
Normal file
90
.forgejo/workflows/botserver.yaml
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
name: GBCI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: gbo
|
||||
|
||||
steps:
|
||||
- name: Disable SSL verification (temporary)
|
||||
run: git config --global http.sslVerify false
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: msrd0/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
targets: >-
|
||||
x86_64-unknown-linux-gnu,
|
||||
aarch64-unknown-linux-gnu,
|
||||
x86_64-pc-windows-gnu,
|
||||
aarch64-pc-windows-msvc,
|
||||
x86_64-apple-darwin,
|
||||
aarch64-apple-darwin
|
||||
|
||||
- name: Install cross-compilation dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc-mingw-w64-x86-64 \
|
||||
gcc-aarch64-linux-gnu \
|
||||
libc6-dev-arm64-cross
|
||||
|
||||
- name: Setup environment
|
||||
run: sudo cp /opt/gbo/bin/system/.env .
|
||||
|
||||
# Linux x86_64
|
||||
- name: Build Linux x86_64
|
||||
run: cargo build --release --locked --target x86_64-unknown-linux-gnu
|
||||
|
||||
# Linux ARM64
|
||||
- name: Build Linux ARM64
|
||||
env:
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: cargo build --release --locked --target aarch64-unknown-linux-gnu
|
||||
|
||||
# Windows x86_64
|
||||
- name: Build Windows x86_64
|
||||
env:
|
||||
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
|
||||
run: cargo build --release --locked --target x86_64-pc-windows-gnu
|
||||
|
||||
# macOS x86_64 (cross-compile)
|
||||
- name: Build macOS x86_64
|
||||
run: cargo build --release --locked --target x86_64-apple-darwin || echo "macOS x86_64 cross-compile requires macOS SDK"
|
||||
|
||||
# macOS ARM64 (cross-compile)
|
||||
- name: Build macOS ARM64
|
||||
run: cargo build --release --locked --target aarch64-apple-darwin || echo "macOS ARM64 cross-compile requires macOS SDK"
|
||||
|
||||
- name: Prepare release artifacts
|
||||
run: |
|
||||
sudo mkdir -p /opt/gbo/releases/botserver/{linux,windows,macos}
|
||||
|
||||
# Linux
|
||||
sudo cp ./target/x86_64-unknown-linux-gnu/release/gbserver /opt/gbo/releases/botserver/linux/gbserver-x86_64 || true
|
||||
sudo cp ./target/aarch64-unknown-linux-gnu/release/gbserver /opt/gbo/releases/botserver/linux/gbserver-aarch64 || true
|
||||
|
||||
# Windows
|
||||
sudo cp ./target/x86_64-pc-windows-gnu/release/gbserver.exe /opt/gbo/releases/botserver/windows/gbserver-x86_64.exe || true
|
||||
|
||||
# macOS
|
||||
sudo cp ./target/x86_64-apple-darwin/release/gbserver /opt/gbo/releases/botserver/macos/gbserver-x86_64 || true
|
||||
sudo cp ./target/aarch64-apple-darwin/release/gbserver /opt/gbo/releases/botserver/macos/gbserver-aarch64 || true
|
||||
|
||||
sudo chmod -R 755 /opt/gbo/releases/botserver/
|
||||
|
||||
- name: Deploy to production and restart
|
||||
run: |
|
||||
lxc exec bot:pragmatismo-system -- systemctl stop system
|
||||
|
||||
sudo cp ./target/x86_64-unknown-linux-gnu/release/gbserver /opt/gbo/bin/system/gbserver
|
||||
sudo chmod +x /opt/gbo/bin/system/gbserver
|
||||
|
||||
lxc exec bot:pragmatismo-system -- systemctl start system
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
name: GBCI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: gbo
|
||||
|
||||
steps:
|
||||
- name: Disable SSL verification (temporary)
|
||||
run: git config --global http.sslVerify false
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: msrd0/rust-toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Run build
|
||||
run: |
|
||||
sudo cp /opt/gbo/bin/system/.env .
|
||||
cargo build --locked
|
||||
|
||||
- name: Deploy binary and restart
|
||||
run: |
|
||||
lxc exec bot:pragmatismo-system -- systemctl stop system
|
||||
|
||||
sudo cp ./target/debug/gbserver /opt/gbo/bin/system
|
||||
sudo chmod +x /opt/gbo/bin/system/gbserver
|
||||
|
||||
lxc exec bot:pragmatismo-system -- systemctl start system
|
||||
Loading…
Add table
Reference in a new issue