From b837244e4265d432cb082d624249f9b373775bee Mon Sep 17 00:00:00 2001 From: yusyus Date: Sat, 17 Jan 2026 21:46:04 +0300 Subject: [PATCH] ci: Add ruff and mypy code quality checks to GitHub Actions Completes issue #250 by adding automated code quality checks to CI. New 'lint' job runs before tests with: - Ruff linter (ruff check) - catches code smells and errors - Ruff formatter (ruff format --check) - ensures consistent formatting - Mypy type checker - validates type annotations Configuration: - Runs on ubuntu-latest with Python 3.12 - Uses existing ruff/mypy config from pyproject.toml (PR #251) - Mypy continues on error (gradual typing adoption) - Both lint and test jobs must pass for PR approval Benefits: - Enforces code quality standards automatically - Catches formatting issues before code review - Prevents regressions in code style - Complements existing test suite Related: - Issue #250 (request for linters) - PR #251 (added ruff/mypy config and formatted codebase) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/tests.yml | 44 +++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e27dcc4..9a0b206 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,38 @@ on: branches: [ main, development ] jobs: + lint: + name: Code Quality (Ruff & Mypy) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run ruff linter + run: | + echo "Running ruff check..." + ruff check src/ tests/ --output-format=github + + - name: Run ruff formatter check + run: | + echo "Checking code formatting..." + ruff format --check src/ tests/ + + - name: Run mypy type checker + run: | + echo "Running mypy type checker..." + mypy src/skill_seekers --show-error-codes --pretty + continue-on-error: true # Don't fail CI on mypy errors initially + test: runs-on: ${{ matrix.os }} strategy: @@ -74,15 +106,19 @@ jobs: # Summary job that provides a single status check for branch protection tests-complete: - name: All Tests Complete - needs: test + name: All Checks Complete + needs: [lint, test] runs-on: ubuntu-latest if: always() steps: - - name: Check test matrix results + - name: Check all results run: | + if [ "${{ needs.lint.result }}" != "success" ]; then + echo "❌ Code quality checks failed!" + exit 1 + fi if [ "${{ needs.test.result }}" != "success" ]; then echo "❌ Tests failed!" exit 1 fi - echo "✅ All tests passed!" + echo "✅ All checks passed!"