-
Notifications
You must be signed in to change notification settings - Fork 5
75 lines (69 loc) · 2.27 KB
/
unit-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: "Unit Test"
on:
schedule:
- cron: "0 9 * * *"
push:
branches: [ main ]
paths:
- '.github/workflows/unit-test.yml'
jobs:
build:
runs-on: ubuntu-latest
env:
ENDPOINT: "http://127.0.0.1:11434"
steps:
-
name: "Clone Repository"
uses: "actions/checkout@v4"
with:
repository: "antoninoLorenzo/AI-OPS"
-
name: "Set up Python 3.11"
uses: actions/setup-python@v4
with:
python-version: '3.11'
-
name: "LLM Requirements - Ollama"
run: curl -fsSL https://ollama.com/install.sh | sh
shell: bash
-
name: "LLM Requirements - Qdrant"
run: docker pull qdrant/qdrant
shell: bash
-
name: "Python Requirements"
run: |
pip install --upgrade pip
pip install -r requirements-api.txt > /dev/null
pip install -r requirements-dev.txt > /dev/null
python -m spacy download en_core_web_md > /dev/null
shell: bash
-
name: "Run Ollama + Pull Models + Run Unit Test"
run: |
# set environment
export PYTHONPATH=$PYTHONPATH:$(pwd)
export OLLAMA_ENDPOINT=${{env.ENDPOINT}}
echo ENDPOINT=${{env.ENDPOINT}} > .env
# run services
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant &
ollama serve &
# wait ollama
for i in {1..3}; do
if curl -s -f -o /dev/null http://127.0.0.1:11434/v1/models; then
echo "[+] Ollama is running"
break
else
echo "[-] Waiting for Ollama to start ..."
sleep 5
fi
done
# pull models
ollama pull nomic-embed-text
ollama pull mistral
# run unit testing
echo "------------------------------------------------------------------------------------------------------"
echo "-----------------------------------------Unit Test----------------------------------------------------"
echo "------------------------------------------------------------------------------------------------------"
python ./test/unit/runner.py
shell: bash