name: CI
on:
push:
branches: [main, develop, holy]
pull_request:
branches: [main, develop, holy]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
# CI-safe features: excludes llamacpp (requires CUDA), lancedb (protoc issues),
# and incomplete vector store implementations (qdrant, pgvector, chromadb, pinecone)
CI_FEATURES: "ollama,openai,local-db,turso,ares-vector,mcp,swagger-ui"
jobs:
# Format check
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
# Lint check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Clippy (default features)
run: cargo clippy --all-targets -- -D warnings
- name: Clippy (CI-safe features)
run: cargo clippy --all-targets --features "$CI_FEATURES" -- -D warnings
# Build matrix for different feature combinations
build:
name: Build (${{ matrix.os }}, ${{ matrix.features }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
features:
[
"default",
"ollama",
"openai",
"ollama,openai",
"ares-vector",
"full",
"minimal",
]
exclude:
# LlamaCpp in 'full' requires native compilation, skip on all CI platforms
- os: ubuntu-latest
features: "full"
- os: windows-latest
features: "full"
- os: macos-latest
features: "full"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Set cache key
id: cache-key
shell: bash
run: echo "features_slug=${FEATURES//,/_}" >> $GITHUB_OUTPUT
env:
FEATURES: ${{ matrix.features }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ steps.cache-key.outputs.features_slug }}
- name: Build
run: cargo build --features "${{ matrix.features }}"
# UI Build (requires WASM target and Node.js/Bun)
build-ui:
name: Build with UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: ubuntu-ui
# Install Bun for Tailwind CSS
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
# Install trunk for building the UI
- name: Install Trunk
run: cargo install trunk --locked
# Build UI assets
- name: Install UI dependencies
run: cd ui && bun install
- name: Build UI
run: cd ui && trunk build --release
# Build backend with UI feature
- name: Build with UI feature
run: cargo build --features "ui"
# Test matrix
test:
name: Test (${{ matrix.os }}, ${{ matrix.features }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
features: ["default", "ollama", "openai", "ollama,openai"]
include:
# Run ares-vector (pure Rust vector DB) tests on all platforms
- os: ubuntu-latest
features: "ares-vector"
- os: windows-latest
features: "ares-vector"
- os: macos-latest
features: "ares-vector"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Set cache key
id: cache-key
shell: bash
run: echo "features_slug=${FEATURES//,/_}" >> $GITHUB_OUTPUT
env:
FEATURES: ${{ matrix.features }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-test-${{ steps.cache-key.outputs.features_slug }}
- name: Run tests
run: cargo test --features "${{ matrix.features }}" --no-fail-fast
# CLI Tests
cli-tests:
name: CLI Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: cli-tests
- name: Run CLI unit tests
run: "cargo test --lib cli:: -- --nocapture"
- name: Run CLI integration tests
run: cargo test --test cli_tests -- --nocapture
- name: Test init command
run: |
cargo build
mkdir -p /tmp/ares-test
./target/debug/ares-server init /tmp/ares-test
test -f /tmp/ares-test/ares.toml
test -d /tmp/ares-test/config/agents
test -d /tmp/ares-test/config/models
- name: Test help command
run: ./target/debug/ares-server --help
- name: Test version command
run: ./target/debug/ares-server --version
# Documentation build check
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build docs
# Use CI-safe features instead of --all-features to avoid CUDA/protoc issues
run: cargo doc --features "$CI_FEATURES" --no-deps
env:
RUSTDOCFLAGS: -D warnings
# Security audit
security-audit:
name: Security Audit
runs-on: ubuntu-latest
# Don't block CI on security vulnerabilities in dependencies
# These should be tracked and addressed separately
continue-on-error: true
permissions:
contents: read
issues: write
checks: write
security-events: write
steps:
- uses: actions/checkout@v4
- uses: rustsec/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Minimal version check (ensures MSRV compatibility)
msrv:
name: Minimum Supported Rust Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.91.0"
- uses: Swatinem/rust-cache@v2
- name: Check MSRV
run: cargo check
# Ollama Integration tests (mocked)
ollama-integration:
name: Ollama Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run Ollama mocked integration tests
run: cargo test --features "ollama" --test ollama_integration_tests -- --nocapture
# Coverage report (optional - runs on Linux only)
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage report
# Use CI-safe features instead of --all-features to avoid CUDA/protoc issues
run: cargo llvm-cov --features "$CI_FEATURES" --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Release build verification
release:
name: Release Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build release
run: cargo build --release
# All checks must pass
ci-success:
name: CI Success
needs:
[
fmt,
clippy,
build,
build-ui,
test,
cli-tests,
docs,
msrv,
ollama-integration,
]
runs-on: ubuntu-latest
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.fmt.result }}" != "success" ]] || \
[[ "${{ needs.clippy.result }}" != "success" ]] || \
[[ "${{ needs.build.result }}" != "success" ]] || \
[[ "${{ needs.build-ui.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.cli-tests.result }}" != "success" ]] || \
[[ "${{ needs.docs.result }}" != "success" ]] || \
[[ "${{ needs.msrv.result }}" != "success" ]] || \
[[ "${{ needs.ollama-integration.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All jobs passed!"