@@ -13,33 +13,129 @@ 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+
64+ # Start openRAG CPU
65+ - name : Start openRAG CPU
66+ run : |
67+ docker compose \
68+ -f docker-compose.yaml \
69+ -f docker-compose-ci.yaml \
70+ --profile cpu up -d \
71+ --no-build
72+
73+ - name : Check containers
2674 run : |
27- curl -LsSf https://astral.sh/uv/install.sh | sh
28- echo "$HOME/.local/bin" >> $GITHUB_PATH
75+ docker compose -f docker-compose.yaml -f docker-compose-ci.yaml --profile cpu ps
76+
77+
78+ - name : Wait for RAG API
79+ run : |
80+ echo "Waiting for RAG API on ${RAG_BASE_URL}..."
81+ for i in {1..60}; do
82+ if curl -fsS "${RAG_BASE_URL}/health_check" > /dev/null 2>&1; then
83+ echo "RAG API is up!"
84+ exit 0
85+ fi
86+ sleep 5
87+ done
88+ docker compose logs
89+ exit 1
90+
91+ # Install uv with cache
92+ - name : Install uv
93+ uses : astral-sh/setup-uv@v3
2994
3095 - name : Cache uv
3196 uses : actions/cache@v4
3297 with :
33- path : |
34- ~/.cache/uv
98+ path : ~/.cache/uv
3599 key : uv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
36100 restore-keys : |
37101 uv-${{ runner.os }}-${{ matrix.python-version }}-
38102
39- - name : Install dependencies with uv
103+ # Install deps for tests
104+ - name : Install with test dependencies
40105 run : |
41- uv sync
106+ uv pip install -e ".[test]"
42107
108+ # Run actual tests
43109 - name : Run tests
44110 run : |
45- uv run pytest
111+ uv run pytest -vv tests
112+
113+
114+
115+ - name : Dump vllm logs on failure
116+ if : failure()
117+ run : |
118+ echo "=== docker compose ps ==="
119+ docker compose -f docker-compose.yaml -f docker-compose-ci.yaml --profile cpu ps || true
120+
121+ echo "=== vllm-cpu logs ==="
122+ docker compose -f docker-compose.yaml -f docker-compose-ci.yaml --profile cpu logs vllm-cpu || true
123+
124+ echo "=== vllm-cpu container inspect (Health) ==="
125+ cid=$(docker ps -aqf "name=vllm-cpu" || true)
126+ if [ -n "$cid" ]; then
127+ docker inspect "$cid" | sed -n '/"State": {/,/}/p' || true
128+ fi
129+
130+
131+ # Dump logs on failure
132+ # - name: Dump logs on failure
133+ # if: failure()
134+ # run: docker compose logs
135+
136+ # Proper shutdown
137+ - name : Shutdown openRAG
138+ if : always()
139+ run : |
140+ docker compose down -v
141+
0 commit comments