@@ -10,7 +10,6 @@ concurrency:
1010 # Don't cancel if running on a push to the main branch.
1111 cancel-in-progress : ${{ (github.event.pull_request.head.ref || github.ref) != 'refs/heads/main' }}
1212
13-
1413on :
1514 push :
1615 branches : [main]
6968 docker pull ollama/ollama
7069 docker run -d --name ollama -p 11434:11434 ollama/ollama
7170
72- - name : Linux - Wait for Ollama and pull models
73- if : matrix.os == 'ubuntu-latest'
74- shell : bash
75- run : |
76- set -eo pipefail
77- until curl -s http://localhost:11434/ > /dev/null; do
78- echo "Ollama not up yet, sleeping..."
79- sleep 1
80- done
81-
82- curl -sSf http://localhost:11434/api/pull -d '{"name": "qwen3:0.6b"}' -v
83- curl -sSf http://localhost:11434/api/pull -d '{"name": "nomic-embed-text"}' -v
84-
8571 - name : Linux - Test installation
8672 if : matrix.os == 'ubuntu-latest'
8773 shell : bash
@@ -111,17 +97,8 @@ jobs:
11197 if : matrix.os == 'windows-latest'
11298 shell : bash
11399 run : |
114- set -eo pipefail
115100 winget install Ollama.Ollama --accept-source-agreements
116101
117- until curl -s http://localhost:11434/ > /dev/null; do
118- echo "Ollama not up yet, sleeping..."
119- sleep 1
120- done
121-
122- curl -sSf http://localhost:11434/api/pull -d '{"name":"qwen3:0.6b"}'
123- curl -sSf http://localhost:11434/api/pull -d '{"name":"nomic-embed-text"}'
124-
125102 - name : Windows - Install the package
126103 if : matrix.os == 'windows-latest'
127104 shell : bash
@@ -139,17 +116,9 @@ jobs:
139116 - name : macOS - Install Ollama
140117 if : matrix.os == 'macos-latest'
141118 run : |
142- set -eo pipefail
143119 brew install ollama
144120 brew services start ollama
145121
146- until curl -s http://localhost:11434/ > /dev/null; do
147- sleep 1
148- done
149-
150- curl -sSf http://localhost:11434/api/pull -d '{"name":"qwen3:0.6b"}'
151- curl -sSf http://localhost:11434/api/pull -d '{"name":"nomic-embed-text"}'
152-
153122 - name : macOS - Test installation
154123 if : matrix.os == 'macos-latest'
155124 shell : bash
@@ -163,6 +132,44 @@ jobs:
163132 # Shared Steps (all OSes)
164133 # ─────────────────────────────────────
165134 #
135+ - name : Wait for Ollama Readiness
136+ shell : bash
137+ run : |
138+ set -eo pipefail
139+ # Wait for Ollama to be responsive (up to 120s)
140+ count=0
141+ until curl -s http://localhost:11434/ > /dev/null || [ $count -eq 24 ]; do
142+ echo "Waiting for Ollama service ($((count * 5))/120s)..."
143+ sleep 5
144+ count=$((count + 1))
145+ done
146+
147+ if [ $count -eq 24 ]; then
148+ echo "Ollama failed to start within 120 seconds"
149+ exit 1
150+ fi
151+ echo "Ollama is ready!"
152+
153+ - name : Pull Ollama Models
154+ uses : nick-fields/retry@v3
155+ with :
156+ max_attempts : 5
157+ retry_wait_seconds : 10
158+ timeout_seconds : 300
159+ shell : bash
160+ command : |
161+ set -eo pipefail
162+
163+ models=("qwen3:0.6b" "nomic-embed-text")
164+ for model in "${models[@]}"; do
165+ echo "Pulling model $model..."
166+ response=$(curl -sS http://localhost:11434/api/pull -d "{\"name\": \"$model\"}")
167+ echo "Response for $model: $response"
168+ if ! echo "$response" | grep -q '"status":"success"'; then
169+ echo "Model pull for $model did not complete successfully"
170+ exit 1
171+ fi
172+ done
166173
167174 - name : Run memmachine-configure
168175 shell : bash
@@ -171,7 +178,7 @@ jobs:
171178 y
172179 Ollama
173180 qwen3:0.6b
174-
181+
175182 http://localhost:11434/v1
176183 nomic-embed-text
177184 768
@@ -180,15 +187,24 @@ jobs:
180187 EOF
181188
182189 - name : Wait for Neo4j to be ready
183- uses : nick-fields/retry@v3
184- with :
185- max_attempts : 12 # 12 × 5s = 60 seconds
186- retry_wait_seconds : 5
187- timeout_seconds : 5
188- shell : bash
189- command : |
190- echo "Checking Neo4j Bolt port on localhost:7687..."
191- curl -sf http://localhost:7474 || exit 1
190+ shell : bash
191+ run : |
192+ set -eo pipefail
193+ echo "Checking Neo4j HTTP port on localhost:7474..."
194+
195+ # Wait up to 120 seconds
196+ count=0
197+ until curl -sf http://localhost:7474/ > /dev/null || [ $count -eq 24 ]; do
198+ echo "Waiting for Neo4j service ($((count * 5))/120s)..."
199+ sleep 5
200+ count=$((count + 1))
201+ done
202+
203+ if [ $count -eq 24 ]; then
204+ echo "Neo4j failed to start within 120 seconds"
205+ exit 1
206+ fi
207+ echo "Neo4j is ready!"
192208
193209 - name : Start memmachine-server
194210 shell : bash
@@ -200,33 +216,39 @@ jobs:
200216 echo "Server PID: $(cat server.pid)"
201217
202218 - name : Wait for server to be ready
203- uses : nick-fields/retry@v3
204- with :
205- max_attempts : 30 # 30 × 10s = 5 minutes
206- retry_wait_seconds : 10
207- timeout_seconds : 10
208- shell : bash
209- command : |
210- set -eo pipefail
211-
212- SERVER_URL="http://127.0.0.1:8080/api/v2/projects/list"
213-
214- echo "Checking server readiness..."
215-
216- http_code=$(curl -X POST -s -o curl_body.tmp -w "%{http_code}" "$SERVER_URL" || true)
217- body=$( [ -f curl_body.tmp ] && cat curl_body.tmp || echo "empty body" )
218- rm -f curl_body.tmp
219+ shell : bash
220+ run : |
221+ set -eo pipefail
222+ HEALTH_URL="http://127.0.0.1:8080/api/v2/health"
223+ READY_URL="http://127.0.0.1:8080/api/v2/projects/list"
224+ echo "Checking server liveness at $HEALTH_URL..."
225+
226+ # Stage 1: Wait for process liveness (up to 300 seconds)
227+ count=0
228+ until curl -sSf "$HEALTH_URL" > /dev/null || [ $count -eq 60 ]; do
229+ echo "Waiting for memmachine-server process ($((count * 5))/300s)..."
230+ sleep 5
231+ count=$((count + 1))
232+ done
219233
220- if [ "$http_code" != "200" ]; then
221- echo "Server not ready yet (HTTP $http_code)"
222- echo "===== Response Body ====="
223- echo "$body"
224- exit 1 # triggers retry
225- fi
234+ if [ $count -eq 60 ]; then
235+ echo "memmachine-server failed to start within 5 minutes"
236+ echo "===== Server Logs ====="
237+ cat server-out.log || echo "Could not read server-out.log"
238+ exit 1
239+ fi
240+ echo "Server process is alive!"
241+
242+ # Stage 2: Verify application readiness
243+ echo "Verifying application readiness at $READY_URL..."
244+ if ! curl -sSf -X POST "$READY_URL" > /dev/null; then
245+ echo "Server is alive but application readiness check failed!"
246+ echo "===== Server Logs ====="
247+ cat server-out.log || echo "Could not read server-out.log"
248+ exit 1
249+ fi
226250
227- echo "Server is ready!"
228- echo "===== Server Response ====="
229- echo "$body"
251+ echo "Server is fully ready!"
230252
231253 - name : Install uv
232254 shell : bash
0 commit comments