diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d63c54d5..83954664c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: integration-test: name: Integration Tests timeout-minutes: 10 - runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} + runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-24.04-32' || 'ubuntu-latest' }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -122,6 +122,59 @@ jobs: flags: integration-tests fail_ci_if_error: false + integration-test-ollama: + name: Integration Tests (Ollama) + if: github.repository_owner == 'coder' + timeout-minutes: 15 + runs-on: self-hosted + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Required for git describe to find tags + + - uses: ./.github/actions/setup-mux + + - name: Check if Ollama is pre-installed + id: check-ollama + run: | + if systemctl is-active --quiet ollama 2>/dev/null && curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; then + echo "installed=true" >> $GITHUB_OUTPUT + echo "✅ Ollama already running (self-hosted runner)" + else + echo "installed=false" >> $GITHUB_OUTPUT + echo "⚙️ Ollama not found, will install" + fi + + - name: Setup Ollama + if: steps.check-ollama.outputs.installed != 'true' + uses: ./.github/actions/setup-ollama + + - name: Verify Ollama server + run: | + echo "Verifying Ollama server..." + timeout 5 sh -c 'until curl -sf http://localhost:11434/api/tags > /dev/null 2>&1; do sleep 0.2; done' + echo "Ollama ready - integration tests will pull models on demand" + + - name: Build worker files + run: make build-main + + - name: Run Ollama integration tests with coverage + run: TEST_INTEGRATION=1 TEST_OLLAMA=1 bun x jest --coverage --maxWorkers=100% --silent "$TEST_TARGET" + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + OLLAMA_BASE_URL: http://localhost:11434/api + TEST_TARGET: ${{ github.event.inputs.test_filter || 'ollama' }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage/lcov.info + flags: integration-tests-ollama + fail_ci_if_error: false + storybook-test: name: Storybook Interaction Tests runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }} diff --git a/tests/ipcMain/runtimeFileEditing.test.ts b/tests/ipcMain/runtimeFileEditing.test.ts index 3a19b6ab8..39fba8d72 100644 --- a/tests/ipcMain/runtimeFileEditing.test.ts +++ b/tests/ipcMain/runtimeFileEditing.test.ts @@ -31,6 +31,7 @@ import { TEST_TIMEOUT_SSH_MS, STREAM_TIMEOUT_LOCAL_MS, STREAM_TIMEOUT_SSH_MS, + configureTestRetries, } from "./helpers"; import { isDockerAvailable, @@ -63,6 +64,9 @@ let sshConfig: SSHServerConfig | undefined; // ============================================================================ describeIntegration("Runtime File Editing Tools", () => { + // Add retries to handle potential AI flakiness (e.g. failing to call tools) + configureTestRetries(3); + beforeAll(async () => { // Check if Docker is available (required for SSH tests) if (!(await isDockerAvailable())) {