Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Builds

on:
push:
branches: ["main"]
paths:
- src/**
- include/**
- examples/**
- client-sdk-rust/**
- CMakeLists.txt
- build.sh
- .github/workflows/**
pull_request:
branches: ["main"]
paths:
- src/**
- include/**
- examples/**
- client-sdk-rust/**
- CMakeLists.txt
- build.sh
- .github/workflows/**
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: macos-latest
# Windows needs protobuf *libraries* too (not just protoc).
# Enable after wiring vcpkg (see notes below).
# - os: windows-latest
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout (with submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

# ---------- OS-specific deps: install protoc + libprotobuf that MATCH ----------
- name: Install deps (Ubuntu)
if: runner.os == 'Linux'
run: |
set -eux
sudo apt-get update
sudo apt-get install -y cmake ninja-build build-essential \
protobuf-compiler libprotobuf-dev libabsl-dev \
libx11-dev libxext-dev libgl1-mesa-dev libssl-dev
protoc --version
pkg-config --modversion protobuf
# Fail if versions don't match (best-effort)
test "$(protoc --version | awk '{print $2}')" = "$(pkg-config --modversion protobuf)" || {
echo "protoc and libprotobuf versions differ"; exit 1; }

- name: Install deps (macOS)
if: runner.os == 'macOS'
run: |
set -eux
brew update
# EITHER: latest protobuf
brew install cmake protobuf ninja
# OR pin a specific version (e.g., protobuf@6) if you need it:
# brew install protobuf@6 && brew link --overwrite --force protobuf@6
protoc --version
pkg-config --modversion protobuf

# ---------- Rust toolchain ----------
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable

# ---------- Cache Cargo ----------
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-reg-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-reg-

- name: Cache Cargo target
uses: actions/cache@v4
with:
path: client-sdk-rust/target
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-

# ---------- Build (Debug / Release) ----------
- name: Build Debug
shell: bash
run: |
chmod +x build.sh
./build.sh debug

- name: Build Release
shell: bash
run: |
./build.sh release

# ---------- Smoke test example (no server needed) ----------
- name: Smoke test example (Debug)
if: runner.os != 'Windows'
shell: bash
run: |
if [[ -x build/examples/SimpleRoom ]]; then
build/examples/SimpleRoom --help || true
fi

# ---------- Cleanup ----------
- name: Clean after build (best-effort)
if: always()
shell: bash
run: |
[[ -x build.sh ]] && ./build.sh clean-all || true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CMakeCache.txt
Makefile
cmake_install.cmake
out
build/
Loading
Loading