Skip to content

Commit 0240751

Browse files
committed
🤖 ci: add self-hosted ollama suite
1 parent db9ecdb commit 0240751

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,59 @@ jobs:
122122
flags: integration-tests
123123
fail_ci_if_error: false
124124

125+
integration-test-ollama:
126+
name: Integration Tests (Ollama)
127+
if: github.repository_owner == 'coder'
128+
timeout-minutes: 15
129+
runs-on: self-hosted
130+
steps:
131+
- name: Checkout code
132+
uses: actions/checkout@v4
133+
with:
134+
fetch-depth: 0 # Required for git describe to find tags
135+
136+
- uses: ./.github/actions/setup-mux
137+
138+
- name: Check if Ollama is pre-installed
139+
id: check-ollama
140+
run: |
141+
if systemctl is-active --quiet ollama 2>/dev/null && curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then
142+
echo "installed=true" >> $GITHUB_OUTPUT
143+
echo "✅ Ollama already running (self-hosted runner)"
144+
else
145+
echo "installed=false" >> $GITHUB_OUTPUT
146+
echo "⚙️ Ollama not found, will install"
147+
fi
148+
149+
- name: Setup Ollama
150+
if: steps.check-ollama.outputs.installed != 'true'
151+
uses: ./.github/actions/setup-ollama
152+
153+
- name: Verify Ollama server
154+
run: |
155+
echo "Verifying Ollama server..."
156+
timeout 5 sh -c 'until curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; do sleep 0.2; done'
157+
echo "Ollama ready - integration tests will pull models on demand"
158+
159+
- name: Build worker files
160+
run: make build-main
161+
162+
- name: Run Ollama integration tests with coverage
163+
run: TEST_INTEGRATION=1 TEST_OLLAMA=1 bun x jest --coverage --maxWorkers=100% --silent "$TEST_TARGET"
164+
env:
165+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
166+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
167+
OLLAMA_BASE_URL: http://localhost:11434/api
168+
TEST_TARGET: ${{ github.event.inputs.test_filter || 'tests/ipcMain/ollama.test.ts' }}
169+
170+
- name: Upload coverage to Codecov
171+
uses: codecov/codecov-action@v5
172+
with:
173+
token: ${{ secrets.CODECOV_TOKEN }}
174+
files: ./coverage/lcov.info
175+
flags: integration-tests-ollama
176+
fail_ci_if_error: false
177+
125178
storybook-test:
126179
name: Storybook Interaction Tests
127180
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}

0 commit comments

Comments
 (0)