Skip to content

ci: enables ollama integration tests #92

ci: enables ollama integration tests

ci: enables ollama integration tests #92

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install uv pytest
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Source Cargo Environment
run: source $HOME/.cargo/env
- name: Run tests
run: uv run pytest tests -m 'not integration'
# To save resources, we only run ollama on the latest version of Python.
# We also piggyback the same job that runs unit tests, so we don't have to
# repeat the same steps.
- name: Cache Ollama models
if: matrix.python-version == '3.12'
id: cache-ollama
uses: actions/cache@v4
with: # make the cache key based on where the OLLAMA_MODEL constant is defined.
path: ~/.ollama/models # default directory for Ollama models
key: ollama-${{ hashFiles('./src/exchange/providers/ollama.py') }}
- name: Start Ollama and pull model
if: matrix.python-version == '3.12'
run: |
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
sleep 5
OLLAMA_MODEL=$(uv run python -c "from src.exchange.providers.ollama import OLLAMA_MODEL; print(OLLAMA_MODEL)")
ollama pull $OLLAMA_MODEL
- name: Run Ollama tests
if: matrix.python-version == '3.12'
run: |
OLLAMA_HOST=http://localhost:11434/ uv run pytest tests -m integration -k ollama