fix: comprehensive code quality improvements - 272 flake8 issues reso… #39
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: Tests and Code Quality | |
| on: | |
| push: | |
| branches: [ main, develop, claude/* ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11'] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| pip install pytest pytest-cov pytest-mock pytest-asyncio black flake8 mypy | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --cov=blastdock --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| if: matrix.python-version == '3.11' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| code-quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black flake8 mypy | |
| pip install -e . | |
| - name: Check code formatting with Black | |
| run: | | |
| black --check blastdock/ tests/ --exclude '/(\.git|\.venv|venv|build|dist)/' | |
| continue-on-error: true | |
| - name: Lint with Flake8 | |
| run: | | |
| flake8 blastdock/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 blastdock/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| continue-on-error: true | |
| - name: Type check with MyPy | |
| run: | | |
| mypy blastdock/ --ignore-missing-imports --no-strict-optional | |
| continue-on-error: true | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install safety bandit | |
| - name: Security check with Safety | |
| run: | | |
| pip install -e . | |
| safety check --json || true | |
| continue-on-error: true | |
| - name: Security check with Bandit | |
| run: | | |
| bandit -r blastdock/ -f json -o bandit-report.json || true | |
| continue-on-error: true |