@@ -13,33 +13,122 @@ jobs:
1313 matrix :
1414 python-version : ["3.12"]
1515
16+ env :
17+ APP_PORT : 8080
18+ RAG_BASE_URL : http://localhost:8080
19+
1620 steps :
1721 - name : Checkout repository
1822 uses : actions/checkout@v4
1923
20- - name : Set up Python
21- uses : actions/setup-python@v5
24+ - name : env file
25+ run : |
26+ cp tests/.env-tests .env
27+
28+ # Move storage to /mnt to avoid disk space issues
29+ - name : Free up space and move Docker storage to /mnt
30+ run : |
31+ echo "Stopping Docker..."
32+ sudo systemctl stop docker
33+
34+ echo "Creating new Docker root at /mnt/docker..."
35+ sudo mkdir -p /mnt/docker
36+ sudo rsync -aqxP /var/lib/docker/ /mnt/docker
37+
38+ echo "Updating Docker daemon config..."
39+ echo '{"data-root": "/mnt/docker"}' | sudo tee /etc/docker/daemon.json
40+
41+ cat /etc/docker/daemon.json
42+
43+ echo "Restarting Docker..."
44+ sudo systemctl start docker
45+
46+ echo "Verifying Docker root directory:"
47+ docker info | grep "Docker Root Dir"
48+
49+ # Setup docker builds with cache
50+ - name : Set up Docker Buildx
51+ uses : docker/setup-buildx-action@v3
52+
53+ - name : Build openrag image
54+ uses : docker/build-push-action@v6
2255 with :
23- python-version : ${{ matrix.python-version }}
56+ context : .
57+ file : ./Dockerfile
58+ tags : linagoraai/openrag:latest
59+ push : false
60+ cache-from : type=gha,scope=openrag
61+ cache-to : type=gha,mode=max,scope=openrag
2462
25- - name : Install uv
63+ - name : Build vllm CPU image
64+ uses : docker/build-push-action@v6
65+ with :
66+ context : ./extern/vllm
67+ file : ./extern/vllm/Dockerfile.cpu
68+ target : vllm-openai
69+ tags : openrag-vllm-openai-cpu
70+ push : false
71+ load : true
72+ cache-from : type=gha,scope=vllm-cpu
73+ cache-to : type=gha,mode=max,scope=vllm-cpu
74+
75+ - name : Check vllm image
76+ run : docker images | grep vllm || true
77+
78+ # Start openRAG CPU
79+ - name : Start openRAG CPU
2680 run : |
27- curl -LsSf https://astral.sh/uv/install.sh | sh
28- echo "$HOME/.local/bin" >> $GITHUB_PATH
81+ docker compose \
82+ -f docker-compose.yaml \
83+ -f docker-compose.ci.yaml \
84+ --profile cpu up -d \
85+ --no-build --pull=never
86+ docker compose --profile cpu up -d
87+
88+ - name : Wait for RAG API
89+ run : |
90+ echo "Waiting for RAG API on ${RAG_BASE_URL}..."
91+ for i in {1..60}; do
92+ if curl -fsS "${RAG_BASE_URL}/health_check" > /dev/null 2>&1; then
93+ echo "RAG API is up!"
94+ exit 0
95+ fi
96+ sleep 5
97+ done
98+ docker compose logs
99+ exit 1
100+
101+ # Install uv with cache
102+ - name : Install uv
103+ uses : astral-sh/setup-uv@v3
29104
30105 - name : Cache uv
31106 uses : actions/cache@v4
32107 with :
33- path : |
34- ~/.cache/uv
108+ path : ~/.cache/uv
35109 key : uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
36110 restore-keys : |
37111 uv-${{ runner.os }}-${{ matrix.python-version }}-
38112
39- - name : Install dependencies with uv
113+ # Install deps for tests
114+ - name : Install with test dependencies
40115 run : |
41- uv sync
116+ uv pip install -e ".[test]"
42117
118+ # Run actual tests
43119 - name : Run tests
44120 run : |
45- uv run pytest
121+ uv run pytest -vv tests
122+
123+
124+ # Dump logs on failure
125+ - name : Dump logs on failure
126+ if : failure()
127+ run : docker compose logs
128+
129+ # Proper shutdown
130+ - name : Shutdown openRAG
131+ if : always()
132+ run : |
133+ docker compose down -v
134+
0 commit comments