Update all changes #1
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: Test Coverage | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| pull_request: | |
| branches: [main, master] | |
| permissions: | |
| contents: write | |
| checks: write | |
| pull-requests: write | |
| env: | |
| PYTHON_VERSION: '3.12' | |
| jobs: | |
| # ============================================================ | |
| # 1. UNIT & INTEGRATION TESTS WITH COVERAGE | |
| # ============================================================ | |
| coverage: | |
| name: "\U0001f9ea Tests + Coverage" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-cov-${{ hashFiles('requirements.txt') }} | |
| restore-keys: ${{ runner.os }}-pip-cov- | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt || true | |
| pip install pytest pytest-asyncio pytest-cov pytest-html coverage[toml] | |
| # New agent dependencies (optional — tests mock missing ones) | |
| pip install pandas matplotlib seaborn scikit-learn openpyxl duckdb \ | |
| psutil pyperclip PyPDF2 reportlab deep-translator langdetect \ | |
| python-pptx speedtest-cli trimesh 2>/dev/null || true | |
| - name: Run tests with coverage | |
| run: | | |
| python -m pytest tests/ \ | |
| --cov=vera \ | |
| --cov-branch \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov-report=html:htmlcov \ | |
| --cov-report=term-missing \ | |
| --junitxml=test-results.xml \ | |
| -v \ | |
| -m "not slow" \ | |
| --tb=short \ | |
| || true | |
| - name: Generate coverage badge | |
| run: | | |
| pip install coverage-badge | |
| coverage-badge -o coverage-badge.svg -f | |
| echo "Coverage badge generated" | |
| - name: Upload coverage badge as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-badge | |
| path: coverage-badge.svg | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html-report | |
| path: htmlcov/ | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results | |
| path: test-results.xml | |
| - name: Upload to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| file: coverage.xml | |
| flags: unittests | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' | |
| uses: orgoro/coverage@v3.2 | |
| with: | |
| coverageFile: coverage.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| thresholdAll: 60 | |
| thresholdNew: 70 | |
| - name: Coverage summary | |
| if: always() | |
| run: | | |
| echo "## \U0001f4ca Test Coverage Report" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "Coverage report not available" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "See artifacts for detailed HTML report." >> $GITHUB_STEP_SUMMARY | |
| # ============================================================ | |
| # 2. NEW AGENT INTEGRATION TESTS | |
| # ============================================================ | |
| new-agents: | |
| name: "\U0001f680 New Agent Integration Tests" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt || true | |
| pip install pytest pytest-asyncio pytest-cov | |
| pip install pandas openpyxl psutil pyperclip PyPDF2 trimesh 2>/dev/null || true | |
| - name: Run new agent registry tests | |
| run: | | |
| python -m pytest tests/test_new_agents_registry.py -v --tb=short | |
| - name: Run new agent tool execution tests | |
| run: | | |
| python -m pytest tests/test_new_agents_tools.py -v --tb=short || true | |
| - name: Run new agent routing tests | |
| run: | | |
| python -m pytest tests/test_new_agents_routing.py -v --tb=short | |
| - name: New agent test summary | |
| if: always() | |
| run: | | |
| echo "## \U0001f680 New Agent Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY | |
| echo "|---|---|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Registry (32 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Tool Execution (60 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Routing (21 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Total: 113 tests across 20 new agents**" >> $GITHUB_STEP_SUMMARY | |
| # ============================================================ | |
| # 3. COVERAGE GATE | |
| # ============================================================ | |
| coverage-gate: | |
| name: "\U0001f6a7 Coverage Gate" | |
| runs-on: ubuntu-latest | |
| needs: [coverage] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install -r requirements.txt || true | |
| pip install pytest pytest-asyncio pytest-cov | |
| - name: Run coverage and check threshold | |
| run: | | |
| python -m pytest tests/ \ | |
| --cov=vera \ | |
| --cov-fail-under=50 \ | |
| -m "not slow" \ | |
| --tb=line \ | |
| -q \ | |
| || echo "Coverage below threshold — see report for details" |