chore(deps): bump uvicorn[standard] from 0.37.0 to 0.38.0 in /backend #77
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backend Tests | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'backend/**' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_USER: pm_master | |
| POSTGRES_PASSWORD: pm_master_pass | |
| POSTGRES_DB: pm_master_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| qdrant: | |
| image: qdrant/qdrant:v1.15.5 | |
| ports: | |
| - 6333:6333 | |
| - 6334:6334 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| cd backend | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| - name: Wait for Qdrant to be ready | |
| run: | | |
| echo "Waiting for Qdrant to be ready..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:6333/healthz > /dev/null 2>&1; then | |
| echo "Qdrant is ready!" | |
| exit 0 | |
| fi | |
| echo "Waiting for Qdrant... attempt $i/30" | |
| sleep 2 | |
| done | |
| echo "Qdrant failed to become ready" | |
| exit 1 | |
| - name: Run tests with coverage | |
| env: | |
| TEST_DATABASE_URL: postgresql+asyncpg://pm_master:pm_master_pass@localhost:5432/pm_master_test | |
| DISABLE_SCHEDULER: '1' | |
| QDRANT_HOST: localhost | |
| QDRANT_PORT: 6333 | |
| run: | | |
| cd backend | |
| pytest --cov=. --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: ./backend/coverage.xml | |
| flags: backend | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Check coverage threshold | |
| run: | | |
| cd backend | |
| # Check if coverage.xml exists | |
| if [ ! -f coverage.xml ]; then | |
| echo "::error::coverage.xml not found. Tests may have failed." | |
| exit 1 | |
| fi | |
| # Parse coverage and check threshold using Python | |
| python << 'EOF' | |
| import xml.etree.ElementTree as ET | |
| import sys | |
| try: | |
| tree = ET.parse('coverage.xml') | |
| root = tree.getroot() | |
| line_rate = float(root.attrib['line-rate']) | |
| coverage_percent = line_rate * 100 | |
| print(f"Coverage: {coverage_percent:.2f}%") | |
| # Target threshold is 60-70% | |
| if coverage_percent < 60: | |
| print(f"::warning::Coverage {coverage_percent:.2f}% is below target threshold of 60%") | |
| else: | |
| print(f"::notice::Backend test coverage: {coverage_percent:.2f}% (target: 60-70%)") | |
| except Exception as e: | |
| print(f"::error::Failed to parse coverage.xml: {e}") | |
| sys.exit(1) | |
| EOF |