V0.12.1 (#106) #36
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
| # Copyright(C) 2024-2025 Advanced Micro Devices, Inc. All rights reserved. | |
| # SPDX-License-Identifier: MIT | |
| # This workflow runs code quality checks (linting) for the entire codebase | |
| # Provides fast feedback on code quality before running platform-specific tests | |
| # Platform: Linux/Ubuntu (cross-platform code analysis) | |
| name: Code Quality (Lint) | |
| on: | |
| workflow_call: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - "src/**" | |
| - "tests/**" | |
| - "installer/**" | |
| - "groundtruth/**" | |
| - "test_data/**" | |
| - "setup.py" | |
| pull_request: | |
| branches: ["main"] | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - "src/**" | |
| - "tests/**" | |
| - "installer/**" | |
| - "groundtruth/**" | |
| - "test_data/**" | |
| - "setup.py" | |
| merge_group: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| name: Run Code Quality Checks | |
| runs-on: ubuntu-latest | |
| if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Check copyright headers | |
| run: | | |
| python util/header.py --check | |
| - name: Install linting dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black pylint isort flake8 mypy bandit | |
| - name: Check code formatting with Black | |
| run: | | |
| black --check --verbose --config pyproject.toml installer src tests | |
| - name: Check import sorting with isort | |
| run: | | |
| isort --check-only --diff installer src tests | |
| - name: Run Pylint (errors only) | |
| run: | | |
| # Install minimal dependencies needed for pylint to work | |
| pip install -e . | |
| # Run pylint matching the PowerShell script configuration | |
| python -m pylint src/gaia --rcfile .pylintrc --disable C0103,C0301,W0246,W0221,E1102,R0401,E0401,W0718 | |
| - name: Run Flake8 | |
| run: | | |
| flake8 installer src tests --exclude=.git,__pycache__,venv,.venv,.mypy_cache,.tox,.eggs,_build,buck-out,node_modules --count --statistics --max-line-length=88 --extend-ignore=E203,W503,E501,F541,W291,W293,E402,F841,E722 | |
| - name: Run MyPy type checking (warning only) | |
| run: | | |
| mypy src/gaia --ignore-missing-imports || echo "MyPy warnings found (non-blocking)" | |
| continue-on-error: true | |
| - name: Test critical imports | |
| run: | | |
| python -c "import gaia.cli; print('OK: CLI module imports')" | |
| python -c "import gaia.chat.sdk; print('OK: Chat SDK imports')" | |
| python -c "import gaia.llm.llm_client; print('OK: LLM client imports')" | |
| python -c "import gaia.agents.base.agent; print('OK: Base agent imports')" | |
| - name: Run Bandit security check (warning only) | |
| run: | | |
| bandit -r src/gaia -ll --exclude .git,__pycache__,venv,.venv,.mypy_cache,.tox,.eggs,_build,buck-out,node_modules || echo "Bandit warnings found (non-blocking)" | |
| continue-on-error: true |