fix: resolve mypy errors in 20 more core/ files (296 → 167) #92
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: CI | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 black isort | |
| - name: Check code style with Black | |
| run: black --check --line-length 100 core/ utils/ handlers/ autort/ cli/ | |
| - name: Check import sorting with isort | |
| run: isort --check-only --profile black core/ utils/ handlers/ autort/ cli/ | |
| - name: Lint with flake8 | |
| run: flake8 --max-line-length 100 --ignore=E501,W503,E402,E203,W504 core/ utils/ handlers/ autort/ cli/ | |
| - name: Install mypy | |
| run: pip install mypy | |
| - name: Type check with mypy | |
| continue-on-error: true # Gradually enforce type checking | |
| run: mypy --python-version 3.10 --ignore-missing-imports --no-strict-optional core/result.py core/container.py core/mcts_planner.py | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install security tools | |
| run: pip install bandit pip-audit safety | |
| - name: Security scan with Bandit | |
| run: bandit -c .bandit -r core/ utils/ handlers/ -f json -o bandit-report.json | |
| - name: Upload Bandit Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: bandit-report | |
| path: bandit-report.json | |
| - name: Dependency vulnerability scan with pip-audit | |
| continue-on-error: true # langchain 0.1.x has known CVEs; upgrade to 0.2+ is a breaking change | |
| run: pip-audit -r requirements.txt | |
| - name: Security audit (pip-audit) | |
| run: | | |
| pip install pip-audit | |
| pip-audit --strict --desc 2>&1 || true # non-blocking for now | |
| - name: Check for hardcoded secrets | |
| run: | | |
| pip install detect-secrets | |
| detect-secrets scan core/ utils/ handlers/ --list-all-secrets || true | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12'] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r requirements-dev.txt | |
| pip install pytest-asyncio pytest-timeout pytest-cov | |
| - name: Check syntax | |
| run: python -m py_compile mcp_stdio_server.py | |
| - name: Run unit tests (fast) | |
| run: | | |
| pytest tests/ \ | |
| --verbose \ | |
| --tb=short \ | |
| --cov=core --cov=handlers --cov=utils --cov=autort --cov=cli \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov-report=term-missing \ | |
| --cov-fail-under=50 \ | |
| --ignore=tests/test_performance_integration.py \ | |
| --ignore=tests/test_modules_jwt.py \ | |
| -m "not slow and not integration and not network" \ | |
| --timeout=30 \ | |
| --maxfail=10 | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: matrix.python-version == '3.10' | |
| with: | |
| name: coverage-report | |
| path: coverage.xml | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [lint, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build wheel | |
| - name: Build package | |
| run: python -m build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |