name: CI
on:
push:
branches: [main, develop]
pull_request:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_MEMEX_REF: 047e63bd9c89bb174fed6e69f9a3a9c203e04981
jobs:
check:
name: ${{ matrix.name }}
runs-on: ${{ fromJSON(matrix.runner) }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-self-hosted
runner: '["self-hosted", "ops-linux"]'
- name: macos-self-hosted
runner: '["self-hosted", "dragon-macos"]'
steps:
- uses: actions/checkout@v6
with:
path: aicx
- name: Checkout rust-memex sibling
uses: actions/checkout@v6
with:
repository: Loctree/rust-memex
ref: ${{ env.RUST_MEMEX_REF }}
path: rust-memex
- name: Ensure unzip on self-hosted Linux
if: runner.os == 'Linux'
run: |
if command -v unzip >/dev/null 2>&1; then
exit 0
fi
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install --yes unzip
else
echo "unzip is required on Linux runners for setup-protoc" >&2
exit 1
fi
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v6
if: runner.os == 'Linux'
with:
python-version: '3.x'
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('aicx/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: semgrep
if: runner.os == 'Linux'
working-directory: aicx
run: |
python -m pip install --upgrade pip semgrep
semgrep --config auto --error --quiet
- name: cargo check
working-directory: aicx
run: cargo check --locked
- name: cargo clippy default
working-directory: aicx
run: cargo clippy --locked -p aicx --all-targets -- -D warnings
- name: cargo clippy native GGUF
working-directory: aicx
run: |
cargo clippy --locked -p aicx-embeddings --features gguf -- -D warnings
cargo clippy --locked -p aicx --features native-embedder --all-targets -- -D warnings
- name: cargo test
working-directory: aicx
run: cargo test --locked --all-targets
- name: cargo test native GGUF
working-directory: aicx
run: |
cargo test --locked -p aicx-embeddings --features gguf
cargo test --locked -p aicx --features native-embedder --test native_embedder
- name: cargo fmt
working-directory: aicx
run: cargo fmt -- --check