-
Notifications
You must be signed in to change notification settings - Fork 0
ci: reproducible deepagent tests + venv workflow #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7907496
e4a566f
efce146
0295ae7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,155 @@ | |||||||||||||||||||||||||||||
| name: Python Tests (consolidated) | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: [ main ] | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: [ main ] | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||||||||
| run_providers: | |||||||||||||||||||||||||||||
| description: 'Set to true to run the providers matrix (manual run)' | |||||||||||||||||||||||||||||
| required: false | |||||||||||||||||||||||||||||
| default: 'false' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| static-analysis: | |||||||||||||||||||||||||||||
| name: Static analysis & unit tests (one python) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.11' | |||||||||||||||||||||||||||||
| - name: Cache pip | |||||||||||||||||||||||||||||
| uses: actions/cache@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
| - name: Install dependencies for static | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| pip install pytest pytest-cov mypy | |||||||||||||||||||||||||||||
| - name: Run unit tests with coverage | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| PYTHONPATH=. pytest --cov=src/ --cov-report=xml | |||||||||||||||||||||||||||||
| - name: Upload coverage to Codecov | |||||||||||||||||||||||||||||
| uses: codecov/codecov-action@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| files: ./coverage.xml | |||||||||||||||||||||||||||||
| fail_ci_if_error: false | |||||||||||||||||||||||||||||
| - name: Run mypy static analysis | |||||||||||||||||||||||||||||
| run: mypy src/ | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| tests: | |||||||||||||||||||||||||||||
| name: Run tests matrix | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| python-version: [3.11, 3.12] | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: ${{ matrix.python-version }} | |||||||||||||||||||||||||||||
| - name: Cache pip | |||||||||||||||||||||||||||||
| uses: actions/cache@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| python -m venv .venv_ci | |||||||||||||||||||||||||||||
| . .venv_ci/bin/activate | |||||||||||||||||||||||||||||
| pip install --upgrade pip setuptools wheel | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| - name: Run tests | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| PYTHONPATH: . | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pytest -q | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| deepagent-test: | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
deepagent is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
|
Comment on lines
+54
to
+85
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/python-test.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: DeepAgent focused tests (fast) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: tests | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: 3.12 | |||||||||||||||||||||||||||||
| - name: Cache pip | |||||||||||||||||||||||||||||
| uses: actions/cache@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-3.12-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
| - name: Install test deps only | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| python -m venv .venv_ci | |||||||||||||||||||||||||||||
| . .venv_ci/bin/activate | |||||||||||||||||||||||||||||
| pip install --upgrade pip setuptools wheel | |||||||||||||||||||||||||||||
| pip install pytest python-dotenv | |||||||||||||||||||||||||||||
| - name: Run deepagent unit tests | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
deepagent is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| PYTHONPATH: . | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pytest -q test/unit/test_deepagent.py test/unit/test_deepagent_providers.py | |||||||||||||||||||||||||||||
Check warningCode scanning / check-spelling Candidate Pattern Warning
Line matches candidate pattern \\b(?i)py(?!gments|gmy|lon|ramid|ro|th)(?=[a-z]{2,}) (candidate-pattern)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
deepagent is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
deepagent is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| provider-smoke: | |||||||||||||||||||||||||||||
|
Comment on lines
+86
to
+115
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/python-test.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Provider smoke (manual) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| if: github.event_name == 'workflow_dispatch' | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: 3.12 | |||||||||||||||||||||||||||||
| - name: Install provider packages | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| python -m venv .venv_ci | |||||||||||||||||||||||||||||
| . .venv_ci/bin/activate | |||||||||||||||||||||||||||||
| pip install --upgrade pip setuptools wheel | |||||||||||||||||||||||||||||
| pip install langchain-google-genai langchain-community langchain-ollama python-dotenv | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
langchain is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
genai is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
langchain is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
langchain is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
ollama is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
| - name: Quick deepagent smoke (dry-run disabled) | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
deepagent is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| PYTHONPATH: . | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| 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))" | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
llm is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| providers: | |||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/python-test.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Providers matrix (optional) | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.run_providers == 'true' | |||||||||||||||||||||||||||||
| strategy: | |||||||||||||||||||||||||||||
| matrix: | |||||||||||||||||||||||||||||
| provider: [gemini, openai, ollama] | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
openai is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
ollama is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: 3.12 | |||||||||||||||||||||||||||||
| - name: Install provider packages | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install --upgrade pip | |||||||||||||||||||||||||||||
| pip install -r requirements.txt | |||||||||||||||||||||||||||||
| pip install langchain-google-genai langchain-community langchain-ollama | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
langchain is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
genai is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
langchain is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
ollama is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
| - name: Run provider smoke for matrix provider | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| PYTHONPATH: . | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| 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))" | |||||||||||||||||||||||||||||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 5 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/python-test.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
|
|
||
| langchain==0.3.27 | ||
| # Note: `langchain-deepagent` is not published on PyPI at the pinned version and | ||
| # caused CI install failures. It's intentionally omitted here; install any | ||
| # deepagent/local adapters manually or in provider-specific CI jobs. | ||
|
|
||
| # Keep provider adapters optional; install them per-job if needed | ||
| # Provider adapters (optional) - pinned to validated versions from the dev environment | ||
| langchain-google-genai==2.1.9 | ||
| langchain-community==0.3.27 | ||
| # Ollama adapter left unpinned (install per-job if needed) | ||
| langchain-ollama==0.3.6 | ||
|
|
||
| # python-dotenv used by the module when running locally | ||
| python-dotenv==1.1.1 | ||
|
|
||
| # Test/runtime helpers | ||
| pytest==8.4.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
Check warningCode scanning / check-spelling Candidate Pattern Warning
Line matches candidate pattern \\b(?:bash|sh|set)(?:\\s+[-+][abefimouxE]{1,2})*\\s+[-+][abefimouxE]{3,}(?:\\s+[-+][abefimouxE]+)* (candidate-pattern)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
euo is not a recognized word. (unrecognized-spelling)
Check failureCode scanning / check-spelling Unrecognized Spelling Error
pipefail is not a recognized word. (unrecognized-spelling)
|
||
|
|
||
| # Lightweight test runner that creates an isolated venv, installs pinned deps, | ||
| # and runs pytest for the repository. Designed for CI and local reproducibility. | ||
|
|
||
| ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
| VENV_DIR="$ROOT_DIR/.venv_ci" | ||
|
|
||
| echo "Using venv: $VENV_DIR" | ||
|
|
||
| if [ ! -d "$VENV_DIR" ]; then | ||
| python3 -m venv "$VENV_DIR" | ||
| fi | ||
|
|
||
| "$VENV_DIR/bin/python" -m pip install --upgrade pip setuptools wheel | ||
| "$VENV_DIR/bin/python" -m pip install -r "$ROOT_DIR/requirements.txt" | ||
| "$VENV_DIR/bin/python" -m pip install pytest==8.4.1 | ||
|
|
||
| PYTHONPATH="$ROOT_DIR" "$VENV_DIR/bin/python" -m pytest "$@" | ||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium