diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a74c59e..e1f96e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI permissions: - contents: read + contents: write on: push: @@ -35,7 +35,7 @@ jobs: # For dev branch: exclude optional tests (docker, llm, performance, pydantic_ai) if [ "${{ github.ref }}" = "refs/heads/main" ]; then echo "Running all tests including optional tests for main branch" - pytest tests/ --cov=DeepResearch --cov-report=xml --cov-report=term-missing --junitxml=junit.xml -o junit_family=legacy + pytest tests/ -m "not containerized" --cov=DeepResearch --cov-report=xml --cov-report=term-missing --junitxml=junit.xml -o junit_family=legacy else echo "Running tests excluding optional tests for dev branch" pytest tests/ -m "not optional and not containerized" --cov=DeepResearch --cov-report=xml --cov-report=term-missing --junitxml=junit.xml -o junit_family=legacy @@ -43,35 +43,115 @@ jobs: - name: Run bioinformatics unit tests (all branches) run: | - echo "đŸ§Ŧ Running bioinformatics unit tests..." + echo "Running bioinformatics unit tests..." pytest tests/test_bioinformatics_tools/ -m "not containerized" --cov=DeepResearch --cov-append --cov-report=xml --cov-report=term-missing --junitxml=junit-bioinformatics.xml -o junit_family=legacy - name: Run bioinformatics containerized tests (main branch only) if: github.ref == 'refs/heads/docker' run: | - echo "đŸŗ Running bioinformatics containerized tests..." + echo "Running bioinformatics containerized tests..." # Check if Docker is available and bioinformatics images exist if docker --version >/dev/null 2>&1; then - make test-bioinformatics-containerized || echo "âš ī¸ Containerized tests failed, but continuing..." + make test-bioinformatics-containerized || echo "Containerized tests failed, but continuing..." else - echo "âš ī¸ Docker not available, skipping containerized tests" + echo "Docker not available, skipping containerized tests" fi + - name: Debug coverage files + run: | + echo "Checking for coverage files..." + ls -la coverage.xml junit.xml junit-bioinformatics.xml || echo "Some files missing" + head -20 coverage.xml || echo "Coverage file not readable" + + # Codecov upload steps - These steps will NOT fail the CI even if uploads fail + # Tests will pass regardless of Codecov upload status + - name: Configure Codecov repository setup + run: | + # Check if CODECOV_TOKEN is available and set HAS_CODECOV_TOKEN flag + if [ -n "${CODECOV_TOKEN}" ]; then + echo "📊 Codecov token found - uploads will be enabled" + echo "🔗 Repository: ${{ github.repository }}" + echo "📈 Coverage reports will be uploaded to Codecov" + echo "✅ Codecov uploads enabled for this run" + echo "HAS_CODECOV_TOKEN=true" >> $GITHUB_ENV + else + echo "âš ī¸ CODECOV_TOKEN not found - uploads will be skipped" + echo "💡 To enable Codecov uploads:" + echo " 1. Go to https://codecov.io/gh/${{ github.repository }}/settings" + echo " 2. Generate a repository upload token" + echo " 3. Add it as CODECOV_TOKEN secret in repository settings" + echo " 4. Repository will be auto-detected on first upload" + echo "HAS_CODECOV_TOKEN=false" >> $GITHUB_ENV + fi + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: Display coverage summary + run: | + echo "📈 Local Coverage Summary:" + echo "==========================" + if command -v coverage >/dev/null 2>&1; then + python -m coverage report --include="DeepResearch/*" --omit="*/tests/*,*/test_*" || echo "Coverage report generation failed" + else + echo "Coverage.py not available for summary" + fi + echo "" + echo "📁 Coverage files generated:" + ls -lh *.xml 2>/dev/null || echo "No XML coverage files found" + echo "" + echo "💡 To view detailed coverage: python -m coverage html && open htmlcov/index.html" + - name: Upload coverage to Codecov + if: env.HAS_CODECOV_TOKEN == 'true' uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: Josephrp/DeepCritical files: ./coverage.xml - fail_ci_if_error: true + fail_ci_if_error: false verbose: true + slug: ${{ github.repository }} + name: "${{ github.ref_name }} - Python ${{ matrix.python-version || '3.11' }}" + continue-on-error: true - name: Upload test results to Codecov - if: ${{ !cancelled() }} + if: env.HAS_CODECOV_TOKEN == 'true' && !cancelled() uses: codecov/test-results-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: Josephrp/DeepCritical + files: ./junit.xml + verbose: true + slug: ${{ github.repository }} + continue-on-error: true + + - name: Upload bioinformatics test results to Codecov + if: env.HAS_CODECOV_TOKEN == 'true' && !cancelled() + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./junit-bioinformatics.xml + verbose: true + slug: ${{ github.repository }} + continue-on-error: true + + - name: Codecov upload summary + if: env.HAS_CODECOV_TOKEN == 'false' + run: | + echo "â„šī¸ Codecov uploads were skipped because CODECOV_TOKEN is not configured" + echo "" + echo "📋 Setup Instructions:" + echo "======================" + echo "1. Visit: https://codecov.io/gh/${{ github.repository }}" + echo "2. Sign in with GitHub" + echo "3. Repository should auto-appear" + echo "4. Go to Settings → Repository Upload Token" + echo "5. Generate and copy the token" + echo "6. Go to GitHub repo Settings → Secrets and variables → Actions" + echo "7. Add new repository secret: CODECOV_TOKEN" + echo "8. Paste the token value" + echo "9. Codecov uploads will work on next run" + echo "" + echo "✅ CI will pass regardless of Codecov upload status" + echo "📊 Coverage reports were still generated locally for inspection" - name: Run VLLM tests (optional, manual trigger only) if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[vllm-tests]') diff --git a/.github/workflows/test-enhanced.yml b/.github/workflows/test-enhanced.yml index c540fe2..ba1d08e 100644 --- a/.github/workflows/test-enhanced.yml +++ b/.github/workflows/test-enhanced.yml @@ -55,11 +55,13 @@ jobs: run: make test-performance - name: Upload coverage reports - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 if: matrix.python-version == '3.11' with: + token: ${{ secrets.CODECOV_TOKEN }} file: ./coverage.xml fail_ci_if_error: false + slug: ${{ github.repository }} - name: Upload test artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/test-optional.yml b/.github/workflows/test-optional.yml index 4bb9598..fb9910a 100644 --- a/.github/workflows/test-optional.yml +++ b/.github/workflows/test-optional.yml @@ -98,9 +98,10 @@ jobs: - name: Upload coverage to Codecov (optional tests) if: always() - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml fail_ci_if_error: false verbose: true + slug: ${{ github.repository }} diff --git a/README.md b/README.md index 8e3e889..912beeb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 🚀 DeepCritical: Building a Highly Configurable Deep Research Agent Ecosystem -[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)][![(https://deepcritical.github.io/DeepCritical)] -https://codecov.io/gh/DeepCritical/DeepCritical/branch/dev/graph/badge.svg?token=N8H1DOUXQL] +[![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://deepcritical.github.io/DeepCritical) +[![codecov](https://codecov.io/gh/DeepCritical/DeepCritical/branch/dev/graph/badge.svg)](https://codecov.io/gh/DeepCritical/DeepCritical) ## Vision: From Single Questions to Research Field Generation @@ -618,6 +618,34 @@ Prompt templates in `configs/prompts/`: ## 🔧 Development +### Development + +### Codecov Setup + +To enable coverage reporting with Codecov: + +1. **Set up the repository in Codecov:** + - Visit [https://app.codecov.io/gh/DeepCritical/DeepCritical](https://app.codecov.io/gh/DeepCritical/DeepCritical) + - Click "Add new repository" or "Setup repo" if prompted + - Follow the setup wizard to connect your GitHub repository + +2. **Generate a Codecov token:** + - In Codecov, go to your repository settings + - Navigate to "Repository Settings" > "Tokens" + - Generate a new token with "upload" permissions + +3. **Add the token as a GitHub secret:** + - In your GitHub repository, go to Settings > Secrets and variables > Actions + - Click "New repository secret" + - Name: `CODECOV_TOKEN` + - Value: Your Codecov token from step 2 + +4. **Verify setup:** + - Push a commit to trigger the CI pipeline + - Check that coverage reports appear in Codecov + +The CI workflow will automatically upload coverage reports once the repository is configured in Codecov and the token is added as a secret. + ### Development with uv ```bash diff --git a/codecov.yml b/codecov.yml index ffe4096..6fe8abf 100644 --- a/codecov.yml +++ b/codecov.yml @@ -10,9 +10,167 @@ coverage: threshold: 1% comment: - layout: "reach,diff,flags,tree" + layout: "condensed_header, condensed_files, condensed_footer" behavior: default require_changes: false + hide_project_coverage: true + +component_management: + default_rules: + statuses: + - type: project + target: auto + threshold: 1% + branches: + - "!main" + individual_components: + # Core Architecture Components + - component_id: core_app + name: Core Application + paths: + - DeepResearch/app.py + - DeepResearch/__init__.py + + - component_id: agents + name: Agents + paths: + - DeepResearch/agents.py + - DeepResearch/src/agents/** + + - component_id: datatypes + name: Data Types + paths: + - DeepResearch/src/datatypes/** + + - component_id: tools + name: Tools + paths: + - DeepResearch/tools/** + - DeepResearch/src/tools/** + + - component_id: statemachines + name: State Machines + paths: + - DeepResearch/src/statemachines/** + - configs/statemachines/** + + - component_id: utils + name: Utilities + paths: + - DeepResearch/src/utils/** + + - component_id: models + name: Models + paths: + - DeepResearch/src/models/** + + - component_id: prompts + name: Prompts + paths: + - DeepResearch/src/prompts/** + - configs/prompts/** + + - component_id: workflow_patterns + name: Workflow Patterns + paths: + - DeepResearch/src/workflow_patterns.py + - DeepResearch/examples/workflow_patterns_demo.py + + # Specialized Components + - component_id: bioinformatics + name: Bioinformatics + paths: + - DeepResearch/src/tools/bioinformatics/** + - DeepResearch/src/agents/bioinformatics_agents.py + - DeepResearch/src/datatypes/bioinformatics*.py + - DeepResearch/src/prompts/bioinformatics*.py + - DeepResearch/src/statemachines/bioinformatics_workflow.py + - configs/bioinformatics/** + - tests/test_bioinformatics_tools/** + - docker/bioinformatics/** + + - component_id: deep_agent + name: Deep Agent + paths: + - DeepResearch/src/agents/deep_agent*.py + - DeepResearch/src/datatypes/deep_agent*.py + - DeepResearch/src/prompts/deep_agent*.py + - DeepResearch/src/statemachines/deep_agent*.py + - DeepResearch/src/tools/deep_agent*.py + - configs/deep_agent/** + + - component_id: rag + name: RAG + paths: + - DeepResearch/src/agents/rag_agent.py + - DeepResearch/src/datatypes/rag.py + - DeepResearch/src/prompts/rag.py + - DeepResearch/src/statemachines/rag_workflow.py + - configs/rag/** + + - component_id: vllm + name: VLLM Integration + paths: + - DeepResearch/src/agents/vllm_agent.py + - DeepResearch/src/datatypes/vllm*.py + - DeepResearch/src/prompts/vllm_agent.py + - configs/vllm/** + - tests/test_llm_framework/** + - tests/test_prompts_vllm/** + - test_artifacts/vllm_tests/** + + - component_id: deepsearch + name: Deep Search + paths: + - DeepResearch/src/tools/deepsearch*.py + - DeepResearch/src/statemachines/deepsearch_workflow.py + - configs/deepsearch/** + + # Test Components + - component_id: test_bioinformatics + name: Bioinformatics Tests + paths: + - tests/test_bioinformatics_tools/** + + - component_id: test_vllm + name: VLLM Tests + paths: + - tests/test_llm_framework/** + - tests/test_prompts_vllm/** + + - component_id: test_pydantic_ai + name: Pydantic AI Tests + paths: + - tests/test_pydantic_ai/** + + - component_id: test_docker_sandbox + name: Docker Sandbox Tests + paths: + - tests/test_docker_sandbox/** + + - component_id: test_core + name: Core Tests + paths: + - tests/test_*.py + + # Configuration and Documentation + - component_id: configuration + name: Configuration + paths: + - configs/** + - pyproject.toml + - codecov.yml + + - component_id: scripts + name: Scripts + paths: + - DeepResearch/scripts/** + - scripts/** + + - component_id: docker + name: Docker + paths: + - docker/** github_checks: annotations: true