-
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 all commits
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,174 @@ | |||||||||||||||||||||||||||||
| 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 ruff (lint) | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -m pip install ruff | |||||||||||||||||||||||||||||
| python -m ruff check src/ | |||||||||||||||||||||||||||||
| - 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 | |||||||||||||||||||||||||||||
| token: ${{ secrets.CODECOV_TOKEN }} | |||||||||||||||||||||||||||||
| - name: Run mypy static analysis | |||||||||||||||||||||||||||||
| run: mypy src/ --ignore-missing-imports --exclude "src/llm/router.py" | |||||||||||||||||||||||||||||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
llm is not a recognized word. (unrecognized-spelling)
|
|||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| 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)
|
|||||||||||||||||||||||||||||
| 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 3 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.
Positive FeedbackNegative Feedback
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: Cache pip for provider-smoke | |||||||||||||||||||||||||||||
| uses: actions/cache@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-provider-smoke-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
| - 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: | |||||||||||||||||||||||||||||
| 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: Cache pip | |||||||||||||||||||||||||||||
| uses: actions/cache@v4 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| path: ~/.cache/pip | |||||||||||||||||||||||||||||
| key: ${{ runner.os }}-pip-providers-${{ matrix.provider }}-${{ hashFiles('**/requirements.txt') }} | |||||||||||||||||||||||||||||
| restore-keys: | | |||||||||||||||||||||||||||||
| ${{ runner.os }}-pip- | |||||||||||||||||||||||||||||
| - 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))" | |||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .PHONY: test lint clean | ||
|
|
||
| # Run tests using the reproducible script (creates .venv_ci) | ||
| test: | ||
| ./scripts/run-tests.sh | ||
|
|
||
| # Run lint and static checks | ||
| lint: | ||
| # Fast lint with ruff and type check with mypy | ||
| python3 -m pip install --upgrade pip | ||
| pip install ruff mypy | ||
| python3 -m ruff check src/ | ||
| python3 -m mypy src/ --ignore-missing-imports | ||
|
|
||
| clean: | ||
| rm -rf .venv_ci |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,29 @@ | |
| - `README.md` – Project overview and usage | ||
| - `Dockerfile` – Container build instructions | ||
|
|
||
| ## Running tests | ||
|
|
||
| We provide a small helper script that creates an isolated virtualenv and runs the test suite. | ||
|
|
||
| Run the full test suite locally: | ||
|
|
||
| ```bash | ||
| ./scripts/run-tests.sh | ||
| ``` | ||
|
|
||
| Or run just the deepagent tests (fast): | ||
|
|
||
| ```bash | ||
| ./scripts/run-tests.sh test/unit -k deepagent | ||
| ``` | ||
|
|
||
| You can also use the Makefile targets: | ||
|
|
||
| ```bash | ||
| make test | ||
| make lint | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Contributing | ||
|
|
@@ -163,7 +186,7 @@ | |
|
|
||
| If you would like to ask a question that you feel doesn't warrant an issue (yet), please reach out to us via Twitter: | ||
|
|
||
| * contact [info@softwaredevlabs.com][conduct-email] | ||
| - contact [info@softwaredevlabs.com][conduct-email] | ||
Check failureCode scanning / check-spelling Unrecognized Spelling Error
softwaredevlabs is not a recognized word. (unrecognized-spelling)
|
||
|
|
||
| ## Developer Guidance | ||
|
|
||
|
|
@@ -190,9 +213,9 @@ | |
| This is a work in progress as we learn what we'll need to provide people in | ||
| order to be effective contributors to our project. | ||
|
|
||
| * [Coding Style](./doc/STYLE.md) | ||
| * [Code Organization](./doc/ORGANIZATION.md) | ||
| * [Exceptions in our legacy codebase](./doc/EXCEPTIONS.md) | ||
| - [Coding Style](./doc/STYLE.md) | ||
| - [Code Organization](./doc/ORGANIZATION.md) | ||
| - [Exceptions in our legacy codebase](./doc/EXCEPTIONS.md) | ||
|
|
||
| --- | ||
|
|
||
|
|
@@ -201,4 +224,7 @@ | |
| This project has adopted the [Code of Conduct][conduct-code]. For more information see the [Code of Conduct][conduct-code] or contact [info@softwaredevlabs.com][conduct-email] with any additional questions or comments. | ||
|
|
||
| [conduct-code](./CODE_OF_CONDUCT.md) | ||
|
|
||
| [conduct-email]: mailto:info@softwaredevlabs.com | ||
| [conduct-code]: ./CODE_OF_CONDUCT.md | ||
| [conduct-email]: mailto:info@softwaredevlabs.com | ||
| 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
Copilot Autofix
AI 3 months ago
To fix the problem, add a
permissionsblock at the root of the workflow file, specifying the minimum required permissions. For most CI jobs that only check out code and run tests,contents: readis sufficient. This block should be added immediately after thename:line and before theon:block, so it applies to all jobs unless overridden. No additional imports or definitions are needed; this is a YAML configuration change.