fix: resolve all CI test failures #3
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: Code Quality | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Format check with black | |
| run: uv run black --check --diff agentic_codegen tests | |
| - name: Import sorting check with isort | |
| run: uv run isort --check-only --diff agentic_codegen tests | |
| - name: Lint with flake8 | |
| run: | | |
| uv run flake8 agentic_codegen tests --count --select=E9,F63,F7,F82 --show-source --statistics | |
| uv run flake8 agentic_codegen tests --count --max-complexity=10 --max-line-length=100 --statistics | |
| - name: Docstring check with flake8-docstrings | |
| run: uv run flake8 agentic_codegen --select=D --ignore=D104,D105,D107 || true | |
| - name: Static analysis with pylint | |
| run: uv pip install pylint && uv run pylint agentic_codegen --disable=all --enable=E,F || true | |
| type-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Type check with mypy | |
| run: uv run mypy agentic_codegen --ignore-missing-imports || true | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Security check with bandit | |
| run: uv run bandit -r agentic_codegen -f txt || true | |
| - name: Dependency check with safety | |
| run: | | |
| uv pip install safety | |
| safety check --json || true | |
| dependency-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check requirements | |
| run: | | |
| # Verify requirements.txt has no duplicates | |
| sort requirements.txt | uniq -d > /tmp/duplicates.txt | |
| if [ -s /tmp/duplicates.txt ]; then | |
| echo "Duplicate dependencies found:" | |
| cat /tmp/duplicates.txt | |
| exit 1 | |
| fi | |
| # Check for built-in modules listed as dependencies | |
| for builtin in ast difflib json re sys os subprocess; do | |
| if grep -q "^$builtin" requirements*.txt; then | |
| echo "Error: $builtin is a built-in module, should not be in requirements" | |
| exit 1 | |
| fi | |
| done | |
| echo "✓ No duplicate dependencies" | |
| echo "✓ No built-in modules in requirements" | |
| spell-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Spell check | |
| uses: codespell-project/actions-codespell@master | |
| with: | |
| ignore_words_file: .codespellignore | |
| skip: .git,.github,__pycache__,.pytest_cache,.venv,venv | |
| comments: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Check formatting issues | |
| id: format-check | |
| run: | | |
| if ! uv run black --check agentic_codegen tests >/dev/null 2>&1; then | |
| echo "format_needed=true" >> $GITHUB_OUTPUT | |
| fi | |
| if ! uv run isort --check-only agentic_codegen tests >/dev/null 2>&1; then | |
| echo "format_needed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Comment on PR if formatting needed | |
| if: steps.format-check.outputs.format_needed == 'true' | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: '⚠️ Code formatting issues detected. Please run:\n```\nuv run black agentic_codegen tests\nuv run isort agentic_codegen tests\n```' | |
| }) |