feat: decouple DB #927
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Ahnlich TestSuite | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- ahnlich/** | |
- sdk/** | |
pull_request: | |
branches: ["main"] | |
paths: | |
- ahnlich/** | |
- sdk/** | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
run-rust-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ahnlich | |
- name: Set up cargo and rustup tools | |
run: | | |
which cargo-nextest || cargo install cargo-nextest | |
- name: Install protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Cache Docker images. | |
uses: ScribeMD/[email protected] | |
with: | |
key: ${{ runner.os }}-cargo-${{ hashFiles('ahnlich/Cargo.lock') }} | |
- name: Cache Ahnlich Home directory images. | |
uses: actions/cache@v4 | |
with: | |
path: ~/.ahnlich | |
key: ${{ runner.os }}-ahnlich-models | |
- name: Format and Lint | |
working-directory: ./ahnlich | |
run: | | |
make format | |
make clippy | |
- name: Check Rust Client is up to date | |
working-directory: ./ahnlich | |
run: | | |
make grpc-update-rust | |
if [[ -n "$(git status . --porcelain)" ]]; then | |
echo "::error::Running 'make grpc-update-rust' caused changes, Please check that rust client is up to date" | |
git --no-pager diff . | |
exit 1 | |
fi | |
- name: Build and Format Rust Example | |
working-directory: ./examples/rust/image-search | |
run: | | |
cargo b && cargo fmt | |
- name: Run Test | |
working-directory: ./ahnlich | |
run: | | |
make test | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: rust | |
path: ahnlich/target/nextest/default/rust.xml | |
run-python-tests: | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Run image | |
uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: 1.7.0 | |
- name: View poetry --help | |
run: poetry --help | |
- name: Cache using poetry lock | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: venv-${{ hashFiles('poetry.lock') }} | |
- name: Installing poetry dependencies | |
working-directory: ./sdk/ahnlich-client-py | |
run: poetry install | |
- name: Check Python Linting | |
working-directory: ./sdk/ahnlich-client-py | |
run: | | |
poetry run isort . -c --profile black; echo $? | |
poetry run black . --check; echo $? | |
- name: Install protoc | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
- name: Complie Binaries | |
working-directory: ./ahnlich | |
run: | | |
cargo build | |
- name: Check Python Client is up to date | |
working-directory: ./ahnlich | |
run: | | |
make grpc-update-python | |
if [[ -n "$(git status ../sdk/ahnlich-client-py --porcelain)" ]]; then | |
echo "::error::Running 'make grpc-update-python' caused changes, Please check that python client is up to date" | |
git --no-pager diff ../sdk/ahnlich-client-py | |
exit 1 | |
fi | |
- name: Run Python Client Tests | |
working-directory: ./sdk/ahnlich-client-py | |
env: | |
AHNLICH_DB_HOST: "127.0.0.1" | |
AHNLICH_DB_PORT: 1349 | |
AHNLICH_AI_HOST: "127.0.0.1" | |
AHNLICH_AI_PORT: 8000 | |
run: | | |
poetry run pytest -s -vv --junitxml=./python.xml | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: python | |
path: sdk/ahnlich-client-py/python.xml | |
run-go-tests: | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ahnlich | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
- name: Setup Go Environment | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22 | |
cache-dependency-path: ./sdk/ahnlich-client-go/go.sum | |
- name: Install Dependencies | |
working-directory: ./sdk/ahnlich-client-go | |
run: make install-dependencies CI=1 | |
- name: Format and Lint Check | |
working-directory: ./sdk/ahnlich-client-go | |
run: make pre-commit-check | |
- name: Run Tests | |
working-directory: ./sdk/ahnlich-client-go | |
run: | | |
make test CACHE=1 REPORT=1 | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: go | |
path: sdk/ahnlich-client-go/go.xml | |
upload-test-results: | |
if: always() | |
runs-on: ubuntu-latest | |
needs: ["run-rust-tests", "run-python-tests", "run-go-tests"] | |
steps: | |
- name: Download Rust Test Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: rust | |
path: ./rust | |
- name: Download Python Test Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: python | |
path: ./python | |
- name: Download Go Test Output | |
uses: actions/download-artifact@v4 | |
with: | |
name: go | |
path: ./go | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action/macos@v2 | |
if: always() | |
with: | |
files: | | |
rust/*.xml | |
python/*.xml | |
go/*.xml |