Skip to content

Commit

Permalink
Ollama: change testing workflow (#551)
Browse files Browse the repository at this point in the history
* try changing workflow

* show coverage

* add healtcheck with timeout
  • Loading branch information
anakin87 authored Mar 6, 2024
1 parent 2a91820 commit 1032b2c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/ollama.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,31 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ["3.9","3.10","3.11"]
services:
ollama:
image: ollama/ollama:latest
options: --name ollama
ports:
- 11434:11434

steps:
- uses: actions/checkout@v4

- name: Install Ollama and pull the required models
run: |
curl -fsSL https://ollama.com/install.sh | sh
ollama serve &
# Check if the service is up and running with a timeout of 60 seconds
timeout=60
while [ $timeout -gt 0 ] && ! curl -sSf http://localhost:11434/ > /dev/null; do
echo "Waiting for Ollama service to start..."
sleep 5
((timeout-=5))
done
if [ $timeout -eq 0 ]; then
echo "Timed out waiting for Ollama service to start."
exit 1
fi
ollama pull ${{ env.LLM_FOR_TESTS }}
ollama pull ${{ env.EMBEDDER_FOR_TESTS }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -55,12 +70,6 @@ jobs:
if: matrix.python-version == '3.9'
run: hatch run lint:all

- name: Pull the LLM in the Ollama service
run: docker exec ollama ollama pull ${{ env.LLM_FOR_TESTS }}

- name: Pull the Embedding Model in the Ollama service
run: docker exec ollama ollama pull ${{ env.EMBEDDER_FOR_TESTS }}

- name: Generate docs
if: matrix.python-version == '3.9' && runner.os == 'Linux'
run: hatch run docs
Expand Down
17 changes: 7 additions & 10 deletions integrations/ollama/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,17 @@ ban-relative-imports = "parents"


[tool.coverage.run]
source_pkgs = ["src", "tests"]
source = ["haystack_integrations"]
branch = true
parallel = true


[tool.coverage.paths]
ollama_haystack = ["src/haystack_integrations", "*/ollama-haystack/src"]
tests = ["tests", "*/ollama-haystack/tests"]
parallel = false

[tool.coverage.report]
omit = ["*/tests/*", "*/__init__.py"]
show_missing=true
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[tool.pytest.ini_options]
Expand Down

0 comments on commit 1032b2c

Please sign in to comment.