|
| 1 | +name: Python Tests (consolidated) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + run_providers: |
| 11 | + description: 'Set to true to run the providers matrix (manual run)' |
| 12 | + required: false |
| 13 | + default: 'false' |
| 14 | + |
| 15 | +jobs: |
| 16 | + static-analysis: |
| 17 | + name: Static analysis & unit tests (one python) |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: '3.11' |
| 25 | + - name: Cache pip |
| 26 | + uses: actions/cache@v4 |
| 27 | + with: |
| 28 | + path: ~/.cache/pip |
| 29 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 30 | + restore-keys: | |
| 31 | + ${{ runner.os }}-pip- |
| 32 | + - name: Install dependencies for static |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade pip |
| 35 | + pip install -r requirements.txt |
| 36 | + pip install pytest pytest-cov mypy |
| 37 | + - name: Run ruff (lint) |
| 38 | + run: | |
| 39 | + python -m pip install ruff |
| 40 | + python -m ruff check src/ |
| 41 | + - name: Run unit tests with coverage |
| 42 | + run: | |
| 43 | + PYTHONPATH=. pytest --cov=src/ --cov-report=xml |
| 44 | + - name: Upload coverage to Codecov |
| 45 | + uses: codecov/codecov-action@v4 |
| 46 | + with: |
| 47 | + files: ./coverage.xml |
| 48 | + fail_ci_if_error: false |
| 49 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 50 | + - name: Run mypy static analysis |
| 51 | + run: mypy src/ --ignore-missing-imports --exclude "src/llm/router.py" |
| 52 | + |
| 53 | + tests: |
| 54 | + name: Run tests matrix |
| 55 | + runs-on: ubuntu-latest |
| 56 | + strategy: |
| 57 | + matrix: |
| 58 | + python-version: [3.11, 3.12] |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - name: Set up Python |
| 62 | + uses: actions/setup-python@v4 |
| 63 | + with: |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + - name: Cache pip |
| 66 | + uses: actions/cache@v4 |
| 67 | + with: |
| 68 | + path: ~/.cache/pip |
| 69 | + key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} |
| 70 | + restore-keys: | |
| 71 | + ${{ runner.os }}-pip- |
| 72 | + - name: Install dependencies |
| 73 | + run: | |
| 74 | + python -m pip install --upgrade pip |
| 75 | + python -m venv .venv_ci |
| 76 | + . .venv_ci/bin/activate |
| 77 | + pip install --upgrade pip setuptools wheel |
| 78 | + pip install -r requirements.txt |
| 79 | + - name: Run tests |
| 80 | + env: |
| 81 | + PYTHONPATH: . |
| 82 | + run: | |
| 83 | + python -m pytest -q |
| 84 | +
|
| 85 | + deepagent-test: |
| 86 | + name: DeepAgent focused tests (fast) |
| 87 | + runs-on: ubuntu-latest |
| 88 | + needs: tests |
| 89 | + steps: |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - name: Set up Python |
| 92 | + uses: actions/setup-python@v4 |
| 93 | + with: |
| 94 | + python-version: 3.12 |
| 95 | + - name: Cache pip |
| 96 | + uses: actions/cache@v4 |
| 97 | + with: |
| 98 | + path: ~/.cache/pip |
| 99 | + key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements.txt') }} |
| 100 | + restore-keys: | |
| 101 | + ${{ runner.os }}-pip- |
| 102 | + - name: Install test deps only |
| 103 | + run: | |
| 104 | + python -m pip install --upgrade pip |
| 105 | + python -m venv .venv_ci |
| 106 | + . .venv_ci/bin/activate |
| 107 | + pip install --upgrade pip setuptools wheel |
| 108 | + pip install pytest python-dotenv |
| 109 | + - name: Run deepagent unit tests |
| 110 | + env: |
| 111 | + PYTHONPATH: . |
| 112 | + run: | |
| 113 | + python -m pytest -q test/unit/test_deepagent.py test/unit/test_deepagent_providers.py |
| 114 | +
|
| 115 | + provider-smoke: |
| 116 | + name: Provider smoke (manual) |
| 117 | + runs-on: ubuntu-latest |
| 118 | + if: github.event_name == 'workflow_dispatch' |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v4 |
| 121 | + - name: Set up Python |
| 122 | + uses: actions/setup-python@v4 |
| 123 | + with: |
| 124 | + python-version: 3.12 |
| 125 | + - name: Install provider packages |
| 126 | + run: | |
| 127 | + python -m pip install --upgrade pip |
| 128 | + python -m venv .venv_ci |
| 129 | + . .venv_ci/bin/activate |
| 130 | + pip install --upgrade pip setuptools wheel |
| 131 | + pip install langchain-google-genai langchain-community langchain-ollama python-dotenv |
| 132 | + - name: Cache pip for provider-smoke |
| 133 | + uses: actions/cache@v4 |
| 134 | + with: |
| 135 | + path: ~/.cache/pip |
| 136 | + key: ${{ runner.os }}-pip-provider-smoke-${{ hashFiles('**/requirements.txt') }} |
| 137 | + restore-keys: | |
| 138 | + ${{ runner.os }}-pip- |
| 139 | + - name: Quick deepagent smoke (dry-run disabled) |
| 140 | + env: |
| 141 | + PYTHONPATH: . |
| 142 | + run: | |
| 143 | + python -c "from src.agents import deepagent; a=deepagent.SDLCFlexibleAgent(provider='gemini', model='chat-bison-001', dry_run=True); print('constructed', getattr(a, 'llm', None))" |
| 144 | +
|
| 145 | + providers: |
| 146 | + name: Providers matrix (optional) |
| 147 | + runs-on: ubuntu-latest |
| 148 | + if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_providers == 'true' |
| 149 | + strategy: |
| 150 | + matrix: |
| 151 | + provider: [gemini, openai, ollama] |
| 152 | + steps: |
| 153 | + - uses: actions/checkout@v4 |
| 154 | + - name: Cache pip |
| 155 | + uses: actions/cache@v4 |
| 156 | + with: |
| 157 | + path: ~/.cache/pip |
| 158 | + key: ${{ runner.os }}-pip-providers-${{ matrix.provider }}-${{ hashFiles('**/requirements.txt') }} |
| 159 | + restore-keys: | |
| 160 | + ${{ runner.os }}-pip- |
| 161 | + - name: Set up Python |
| 162 | + uses: actions/setup-python@v4 |
| 163 | + with: |
| 164 | + python-version: 3.12 |
| 165 | + - name: Install provider packages |
| 166 | + run: | |
| 167 | + python -m pip install --upgrade pip |
| 168 | + pip install -r requirements.txt |
| 169 | + pip install langchain-google-genai langchain-community langchain-ollama |
| 170 | + - name: Run provider smoke for matrix provider |
| 171 | + env: |
| 172 | + PYTHONPATH: . |
| 173 | + run: | |
| 174 | + python -c "from src.agents import deepagent; p='${{ matrix.provider }}'; d = deepagent.SDLCFlexibleAgent(provider=p, dry_run=True); print('provider', p, 'dry_run', getattr(d, 'dry_run', False))" |
0 commit comments