Skip to content

fix(ci): health check tests isolate env vars, status endpoint safe ev… #49

fix(ci): health check tests isolate env vars, status endpoint safe ev…

fix(ci): health check tests isolate env vars, status endpoint safe ev… #49

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
services:
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: agentmanager_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run unit tests with coverage
id: unit-tests
run: |
pytest tests/unit/ -v --cov=agentManager --cov-report=term-missing --cov-report=xml
env:
REDIS_URL: redis://localhost:6379
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/agentmanager_test
- name: Check coverage threshold
id: coverage-threshold
if: matrix.python-version == '3.10' || matrix.python-version == '3.12'
run: |
coverage report --fail-under=80
- name: Run e2e tests
id: e2e-tests
run: |
pytest tests/e2e/ -v --no-cov
env:
REDIS_URL: redis://localhost:6379
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/agentmanager_test
- name: Run mypy type checking (core modules)
id: mypy-core
run: |
mypy agentManager/runtime/ agentManager/storage/ agentManager/config/ --ignore-missing-imports
- name: Run mypy type checking (advisory)
id: mypy-advisory
if: always()
run: |
mypy agentManager/ --ignore-missing-imports || true
- name: Run flake8 code style check
id: flake8
run: |
flake8 agentManager/ tests/ --max-line-length=100 --count --statistics
- name: Run durable backend integration tests
id: durable-tests
run: |
pytest tests/unit/test_storage_backends.py tests/unit/test_state_manager.py tests/unit/test_checkpoint.py tests/unit/test_redis_stream_event_bus.py -v --no-cov
env:
REDIS_URL: redis://localhost:6379
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/agentmanager_test
- name: Generate verification summary
if: always()
run: |
python scripts/collect_ci_status.py \
--output ".test-artifacts/verification-summary-python-${{ matrix.python-version }}.md" \
--python-version "${{ matrix.python-version }}" \
--command-result "${{ steps.unit-tests.outcome || 'unknown' }}::pytest tests/unit/ -v --cov=agentManager --cov-report=term-missing --cov-report=xml::unit tests with coverage" \
--command-result "${{ steps.coverage-threshold.outcome || 'skipped' }}::coverage report --fail-under=80::coverage threshold on Python 3.10 and 3.12" \
--command-result "${{ steps.e2e-tests.outcome || 'unknown' }}::pytest tests/e2e/ -v --no-cov::end-to-end tests" \
--command-result "${{ steps.mypy-core.outcome || 'unknown' }}::mypy agentManager/runtime/ agentManager/storage/ agentManager/config/ --ignore-missing-imports::type checking (core modules - blocking)" \
--command-result "${{ steps.mypy-advisory.outcome || 'unknown' }}::mypy agentManager/ --ignore-missing-imports || true::type checking (advisory)" \
--command-result "${{ steps.flake8.outcome || 'unknown' }}::flake8 agentManager/ tests/ --max-line-length=100 --count --statistics::code style check" \
--command-result "${{ steps.durable-tests.outcome || 'unknown' }}::pytest tests/unit/test_storage_backends.py tests/unit/test_state_manager.py tests/unit/test_checkpoint.py tests/unit/test_redis_stream_event_bus.py -v --no-cov::durable backend integration tests"
- name: Upload verification summary
if: always()
uses: actions/upload-artifact@v4
with:
name: verification-summary-python-${{ matrix.python-version }}
path: .test-artifacts/verification-summary-python-${{ matrix.python-version }}.md
if-no-files-found: error
- name: Upload coverage to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Comment PR with coverage
if: github.event_name == 'pull_request' && matrix.python-version == '3.10'
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 80
MINIMUM_ORANGE: 60
docker-verify:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Verify compose syntax
run: docker compose config
- name: Build production image
run: docker build -f Dockerfile.prod -t agentmanager:prod .
- name: Build development image
run: docker build -f Dockerfile.dev -t agentmanager:dev .
sandbox-integration:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,sandbox]"
- name: Run Docker sandbox integration tests
run: pytest tests/integration/test_sandbox_docker.py -v --no-cov -m integration