name: CI
on:
push:
branches: [main, develop]
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read rust-toolchain channel
id: rust-channel
run: |
if grep -q 'channel = "' rust-toolchain.toml 2>/dev/null; then
CHANNEL=$(grep 'channel = "' rust-toolchain.toml | sed 's/.*= "\([^"]*\)".*/\1/')
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-channel.outputs.channel }}
components: rustfmt, clippy
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy (core crates)
run: |
cargo clippy \
-p oxios-kernel --features "sqlite-memory" \
-p oxios-ouroboros -p oxios-gateway -p oxios-markdown \
-p oxios-mcp -p oxios-memory -p oxios-calendar \
-- \
-D warnings
frontend:
name: frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Install deps
working-directory: surface/oxios-web/web
run: bun install --frozen-lockfile
- name: Type check
working-directory: surface/oxios-web/web
run: bun run typecheck
- name: Unit tests
working-directory: surface/oxios-web/web
run: bun run test
- name: Lint
working-directory: surface/oxios-web/web
run: bun run lint
- name: Build
working-directory: surface/oxios-web/web
run: bun run build
test:
name: test
runs-on: ubuntu-latest
needs: [fmt, frontend]
strategy:
fail-fast: false
matrix:
partition:
- [1/4, 1]
- [2/4, 1]
- [3/4, 1]
- [4/4, 1]
steps:
- uses: actions/checkout@v4
- name: Read rust-toolchain channel
id: rust-channel
run: |
if grep -q 'channel = "' rust-toolchain.toml 2>/dev/null; then
CHANNEL=$(grep 'channel = "' rust-toolchain.toml | sed 's/.*= "\([^"]*\)".*/\1/')
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-channel.outputs.channel }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
- name: Cache target directory
uses: actions/cache@v4
with:
path: target
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}-
- name: Run unit tests (partitioned)
run: |
cargo nextest run --workspace \
--partition count:${{ matrix.partition[0] }}/${{ matrix.partition[1] }} \
--no-fail-fast
- name: Run doc tests
run: cargo test --workspace --doc
audit:
name: audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read rust-toolchain channel
id: rust-channel
run: |
if grep -q 'channel = "' rust-toolchain.toml 2>/dev/null; then
CHANNEL=$(grep 'channel = "' rust-toolchain.toml | sed 's/.*= "\([^"]*\)".*/\1/')
echo "channel=$CHANNEL" >> $GITHUB_OUTPUT
else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-channel.outputs.channel }}
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- name: Security audit
continue-on-error: true
run: cargo audit
summary:
name: summary
needs: [fmt, frontend, test, audit]
runs-on: ubuntu-latest
if: always()
steps:
- name: All checks passed
run: echo "✅ All CI checks passed"